Lu lua
A complete quiz-based curriculum covering Lua from first principles to expert-level, production-grade knowledge. Lua's minimalism is deceptive — nearly everything (objects, modules, namespaces) is built from one primitive, the table, and this track is sequenced around the handful of mechanisms (metatables, closures, coroutines) that make that possible.
Part 1 — Foundations
6 topicsIntroduction & Setup
lua vs luajit, embedding vs standalone, and version fragmentation (5.1–5.4) shape which features and libraries are actually available.
Variables & Data Types
Globals-by-default, nil, and the integer/float subtype split (5.3+) are frequent sources of subtle bugs.
Operators & Expressions
String-to-number coercion via arithmetic operators and .. concatenation are classic gotcha territory.
Control Flow
repeat...until's scoping quirk and the absence of break-with-label (only goto) surprise newcomers.
Strings & Patterns
Lua patterns are not regex — the differences trip up anyone assuming PCRE-style syntax.
Tables
The array/hash duality and the famously undefined # operator on tables with holes are the single biggest source of Lua bugs.
Part 2 — Functions & Scope
4 topicsFunctions
Multiple return values and varargs (...) are used pervasively and behave differently from most mainstream languages.
Closures & Upvalues
Shared upvalues across loop iterations are Lua's version of the classic JS var-in-a-loop bug.
Metatables & Metamethods
__index/__newindex and operator metamethods are how Lua achieves everything from OOP to operator overloading.
OOP with Tables & Metatables
Colon-call sugar (obj:method()) hides an implicit self that's a frequent source of attempt to call a nil value errors.
Part 3 — Control & Errors
3 topicsError Handling
pcall/xpcall and non-string error objects are Lua's whole error model — there's no try/catch.
Coroutines
resume/yield state machines power generators, cooperative schedulers, and game-engine update loops.
Modules & require
require caching and package.path resolution order are essential for structuring any non-trivial project.
Part 4 — Advanced & Systems
8 topicsGarbage Collection
Incremental vs. generational GC (5.4) and weak tables matter for anyone building caches or long-running processes.
The C API & FFI
Lua's defining use case is embedding — the stack-based C API and LuaJIT's FFI are how host applications actually integrate it.
Advanced Metaprogramming
__call, __tostring, and proxy tables via __index/__newindex enable sandboxing and DSL-style APIs.
Standard Library Deep Dive
table.sort stability, os.time granularity, and io buffering behavior matter in real scripts.
Performance & LuaJIT
JIT trace compilation, deoptimization triggers, and table pre-sizing are where Lua performance work actually happens.
Testing
Frameworks like busted and luaunit, plus common assertion/mocking patterns, determine test suite trustworthiness.
Security
load/loadstring on untrusted input and unsandboxed os.execute are the most common Lua vulnerabilities (notably in game modding and CDN edge scripts).
Exercises & Projects (Capstone)
A mixed-review capstone spanning metatables, coroutines, closures, and error handling.