Introduction
Why Lua?
Lua is a lightweight, embeddable scripting language designed for extending applications. It powers game scripting (Roblox, World of Warcraft, LOVE2D), embedded systems, and configuration for tools like Neovim, Redis, and Nginx.
- Simple and elegant — Lua has a tiny core with just 8 basic types and one data structure (the table).
- Fast — LuaJIT is one of the fastest dynamic language runtimes ever built.
- Embeddable — Lua was designed from day one to be embedded in C/C++ applications.
- Tables are everything — arrays, dictionaries, objects, modules, and namespaces are all tables.
What You Will Learn
- Variables and types — dynamic typing with
localdeclarations - Strings — concatenation with
.., thestringlibrary - Control flow —
if/elseif/else,while,repeat/until, numeric and genericfor - Functions — first-class functions, closures, variadic arguments
- Tables — arrays (1-indexed), dictionaries, metatables for OOP
- Modules — organizing code with table-based modules
- Coroutines — cooperative multitasking via iterator patterns
Resources
- Lua Official Documentation — the official language reference manual.
- Programming in Lua by Roberto Ierusalimschy — the definitive book on Lua.
- Lua Users Wiki — community-maintained tutorials and code samples.
- LOVE2D — a popular 2D game framework that uses Lua.
- Exercism Lua Track — practice problems with mentoring.