Lore archive · Warcraft Wiki, 2023 dump
Introduction to Lua
Last wiki revision 2023-09-10
Lua is a scripting language and is used in the WoW User Interface and addons.
- It's recommended to use a simple text editor like VS Code or Notepad++
- You will need an AddOn to test your code in, or the WowLua addon.
You can also use the Lua Demo or get Lua on your machine. Note that World of Warcraft uses Lua 5.1.
This guide will follow the Learn X in Y minutes format.
- Reference: PIL: Types and Values, Reference Manual
- Reference: PIL: Relational Operators, Logical Operators
- Reference: MathLibraryTutorial, Reference Manual
- Reference: String Manipulation, String Library Tutorial
Patterns
- Reference: PatternsTutorial, PIL: Patterns, Reference Manual
- Reference: PIL: Control Structures
- Reference: PIL: Functions
Syntactic sugar
- References: WowAce coding tips, Difference between . and : in Lua
- Reference: PIL: Tables, Tables Tutorial, Arrays
Sorting
Global Environment
- References: PIL: The Environment, Reference Manual
ipairs vs pairs
- References: For Tutorial, Difference between pairs and ipairs in Lua, PIL: Stateless Iterators
- Follow-up: Create a WoW AddOn in 15 Minutes
API Reference
- Lua functions - The Lua 5.1 API as implemented in WoW
- https://www.lua.org/manual/5.1/ - Reference Manual (5.1)
Tutorials
- https://www.mmo-champion.com/threads/817817-Creating-Your-Own-WoW-Addon - MMO-Champion tutorial
- https://www.lua.org/start.html - Getting started with Lua
- https://www.lua.org/pil/contents.html - Programming in Lua (online version)
- https://en.wikibooks.org/wiki/Lua_Programming - Wikibooks tutorial
- https://wiki.facepunch.com/gmod/Beginner_Tutorial_Intro - Garry's Mod tutorial
- https://developer.roblox.com/en-us/learn-roblox/coding-scripts - Roblox tutorial
Style Guides
These may be helpful for seeing what coding conventions other projects follow. See also Lua Coding Tips for best practices.
- https://github.com/Olivine-Labs/lua-style-guide/
- https://github.com/luarocks/lua-style-guide
- http://lua-users.org/wiki/LuaStyleGuide
Source
https://warcraft.wiki.gg/wiki/Introduction_to_Lua · retrieved 2023-11-13 · CC BY-SA 4.0
Converted from wikitext with templates, tables and images removed, so some sentences may be missing values.
This archive predates WoW: Forever. For collected gameplay facts see the Forever database. Search the archive.