FREE COURSE / REAL PRACTICE
Lua programming
Learn values, tables, functions and modules before exploring metatables, iterators, coroutines and resource cleanup.
What you’ll work toward
Build small Lua programs with explicit interfaces, dependable iteration and controlled resource lifetimes.
Read an explanation, inspect the diagrams and work through the available checks, debugging exercises and builds. Feedback and prerequisite links guide the next step.
Before you start
The entry lesson has no earlier CodeRigor skill prerequisite. Start there and follow the sequence.
Individual lessons can add prerequisites. The course map shows your actual readiness.
A look inside the first lesson
for _, value in ipairs({false, 0, ""}) do
print(type(value), value and "truthy" or "falsey")
end
print(type(nil), nil and "truthy" or "falsey")Your course outline
Follow the lessons in curriculum order. Open a unit to preview the ideas you’ll work with.
Lua: values, functions & tables
- LESSON 01.01
Values, types & truthiness
Distinguish nil, false and truthy values, keep types explicit, and use local names in a Lua chunk.
Open lesson - LESSON 01.02
Control flow, functions & multiple results
Write local functions, validate preconditions and distinguish a function’s returned values from printed output.
Open lesson - LESSON 01.03
Tables, sequences & missing entries
Use table keys and explicit lengths without confusing nil holes, false values and sequence boundaries.
Open lesson
Lua: parsing, modules & errors
- LESSON 02.01
Strings, byte boundaries & Lua patterns
Use anchored Lua patterns, explicit conversions and byte-aware string operations for a small record format.
Open lesson - LESSON 02.02
Modules, local state & error contracts
Export a module table, keep globals clean and choose returned error values or protected calls deliberately.
Open lesson
Lua: metatables & iterators
- LESSON 03.01
Metatables, lookup & proxy contracts
Use lookup and assignment metamethods while understanding when raw table entries bypass them.
Open lesson - LESSON 03.02
Closures, captured state & iterators
Capture independent iterator state and use nil termination without confusing zero with absence.
Open lesson
Lua: coroutines & resources
- LESSON 04.01
Coroutines, yield & resume protocols
Separate yielded values, completion and errors using resume results and coroutine status.
Open lesson - LESSON 04.02
Files, errors & deterministic resource cleanup
Read files without losing empty or final lines, report open failures and close handles deterministically.
Open lesson