Booklet one of two: Foundations to tables Chapters one to four Fall twenty twenty-six
One. Smallness, with numbers
Two. What "embeddable" actually means
Three. What the design brief predicts
Four. Where you will actually meet Lua
Five. Which Lua this book teaches
Setting Up the Environment
One. Getting an interpreter
Two. Writing and running your first program
Three. Choosing an editor
Four. Which Lua did you just install?
One. There are exactly eight
Two. The falsity rule, stated exactly
Three. nil: absence, and deletion
Four. Booleans, and why the rule in section two is not redundant
Five. Numbers: integers and floats
Six. Strings and functions, briefly
Chapter two: Variables and Control Flow
One. local, and the exact scope rule
Two. What a global actually is
Chapter two: Variables and Control Flow
Three. The three things it explains
Four. _ G, and reading the environment as data
Five. Declare late, and initialise
Two. while and repeat until
Five. break, and the missing continue
Six. Choosing between them
Chapter two: Variables and Control Flow
Two. The two definitions everything else follows from
Three. The default-value idiom, derived
Four. The ternary idiom, and exactly when it breaks
Five. Guard clauses and short-circuiting
Six. Comparison operators, briefly
One. Functions are values, and declaration is just assignment
Two. Functions as values: stored, passed, returned
Three. Anonymous functions
Here is where the scope rule from Chapter Two gets cashed in. The manual defines the term directly:
Three. select: counting and slicing the extra arguments
Four. Named arguments via a table
One. A function can return more than one value
Two. Truncation: only the last position sees everything
Four. The colon-call sugar, previewed
One. Tables are made with a constructor
Two. Keys can be almost anything, including tables and functions
Three. nil means "not present," and assigning it deletes
Four. Tables are references, not values, and assignment never copies
One. table.insert and table.remove
Four. The real contract of number
Five. Counting when a table has holes
Tables as Arrays and Dictionaries
One. One-based indexing is a convention, not a rule
Two. ipairs: a well-defined walk that stops at the first hole
Three. pairs: every key, in an order you may not rely on
Four. Choosing between ipairs and pairs
Five. Nested tables: the same structure, one level deeper