Introduction to Lua

Lua is a scripting language and is used in the WoW User Interface and addons.

Getting started

 * 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 a slightly modified version of Lua 5.1 is used in WoW.

This guide will follow the Learn X in Y minutes format.

Variables

 * Reference: PIL: Types and Values, Reference Manual

Boolean Logic

 * Reference: PIL: Relational Operators, Logical Operators

Math

 * Reference: MathLibraryTutorial, Reference Manual

Strings

 * Reference: String Manipulation, String Library Tutorial

Patterns
 * Reference: PatternsTutorial, PIL: Patterns, Reference Manual

Control Flow

 * Reference: PIL: Control Structures

Functions

 * Reference: PIL: Functions

Syntactic sugar
 * References: WowAce coding tips, Difference between . and : in Lua

Tables

 * Reference: PIL: Tables, Tables Tutorial, Arrays



Sorting

Details
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 under 15 Minutes

Resources
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