Lua Training

A Lua 5.4 programming course delivered as code + per-lesson reveal.js slide decks. Starts at programming-101 and finishes with coroutines, performance, packaging with LuaRocks, and embedding.

Phase 1 · Foundations
01
Hello, Lua
lua · REPL · print · busted
02
Values & types
nil·boolean·number·string · truthiness
03
Variables & scope
local vs global · <const>
04
Operators & expressions
// · and·or · .. · # · bitwise
05
Control flow
if·elseif · while · repeat · for · goto
06
Functions & testing
multiple returns · varargs · busted
07
Phase 1 capstone — CLI
arg · io · multi-function
Phase 2 · The Heart of Lua
08
Tables: the one data structure
arrays (1-based) · maps · table · pairs
09
Strings & patterns
Lua patterns · match·gsub · format
10
Metatables & metamethods
__index · __newindex · __call
11
OOP in Lua
metatables · : and self · inheritance
12
Modules & require
require · package.path · module table
13
Errors & robustness
pcall·error · nil,err · <close>
Phase 3 · Idiomatic & Advanced Lua
14
Iterators & the generic for
stateless·stateful · next · closures
15
Closures & functional Lua
upvalues · higher-order · memoize
16
Coroutines
create·resume·yield · generators
17
Standard library & I/O
os · io · math · utf8 · load
18
Environments, GC & performance
_ENV · GC · weak tables · perf
Phase 4 · Packaging & Embedding
19
LuaRocks & writing a module
rockspec · install · publish · semver
20
Embedding Lua (host provided)
lua_State · stack · call Lua from C
21
Extending Lua (host API)
lua_CFunction · luaL_newlib · .so
22
Sandboxing & plugin patterns
_ENV sandbox · debug.sethook
23
Capstone: embeddable scripting host
plugins · config DSL · wrap-up