Learn Lua in 15 Minutes
luaprogramming-languagetutorialscripting
Abstraction: Concise Lua language tutorial covering syntax, tables, metatables, and modules
Key points:
- All Lua numbers are 64-bit doubles; only
nilandfalseare falsy — 0 and empty string are truthy. - Tables are Lua's sole compound data structure, serving as both dictionaries and arrays; array indices start at 1.
- Metatables enable operator overloading and prototype-based inheritance via
__index,__add, and other metamethods. - Functions are first-class values; closures, anonymous functions, and multiple return values are natively supported.
- Modules are implemented as tables returned from files loaded with
require;requirecaches results so files run at most once. - Written to accompany the Löve 2D game engine; the entire tutorial file is valid, runnable Lua.
Connections: Lua · Programming Languages · Scripting Languages · Metatables