Booklet two of two: Metatables to embedding Chapters five to eight Fall twenty twenty-six
One. Members are keys, not values
Chapter five: Metatables and OOP
Two. Adding, removing, and counting
Three. Union, intersection, difference
Four. Bags: counting instead of true
Chapter five: Metatables and OOP
Five. Three traps that make a set silently wrong
Six. The gap this lecture leaves open
Chapter five: Metatables and Object Oriented Programming
Three facts about who owns a metatable, all from the manual:
Two. When Lua looks, and where
Chapter Five: Metatables and Object-Oriented Programming
Three. Cashing in the "Tables as Sets" set
Four. _ index: what to do about a missing key
Five. _ newindex: what to do about a new key
Six. The raw functions, and the recursion they prevent
Seven. Protecting a metatable with _metatable
Chapter five: Metatables and OOP
Object-Oriented Programming with Metatables
One. The colon, cashed in
Two. A class is a metatable that points at itself
Three. The Programming in Lua constructor, and why it looks odd
Four. Inheritance is a longer __index chain
Five. Operators on a class, and the inheritance trap
Chapter five: Metatables and OOP
Seven. Why Lua has no class keyword
Chapter Five: Metatables and OOP
Chapter Six: Standard Library and Modules
One. The box is made of tables
Two. Strings: slicing, case, repetition
Chapter six: Standard Library and Modules
Three. Lua patterns are not regular expressions
Four. The four pattern functions
Chapter six: Standard Library and Modules
Five. gsub with a string, a table, a function
Chapter six: Standard Library and Modules
Eleven. Details worth knowing in five point four
Chapter six: Standard Library and Modules
One. The return-a-table pattern
Chapter Six: Standard Library and Modules
Three. package.path: how a name becomes a file
Four. Hands-on: splitting a script into modules
Five. Keeping globals out
Chapter Six: Standard Library and Modules
Chapter Seven: Coroutines
Two. Create, resume, yield
Four. Passing values in both directions
Chapter seven: Coroutines
Five. resume versus wrap, and what errors do
coroutine.wrap packages create and resume into a single function:
Six. isyieldable, running and close
Using Coroutines for Concurrency
One. Iterators are producers
The recursion that shows what "true" means
Two. Producers and consumers
Three. A round-robin scheduler
Four. Errors inside a scheduled task
Chapter Eight: Embedding and Synthesis
One. The smallest embedder
Chapter Eight: Embedding and Synthesis
Four. Giving Lua a C function
Five. Calling Lua, and why pcall
CODE calling with lua_call (unprotected) ...
Six. Controlling what a script can touch
Chapter eight: Embedding and Synthesis
Chapter eight: Embedding and Synthesis
One. A four-question method
Two. Check for Chapter one: what counts as true, and what kind of number is this?
Three. Check for Chapter two: who owns this variable?
Five. Check for Chapter four: the length trap
Six. Check for Chapter five: where does a method come from?
Chapter eight: Embedding and Synthesis
Seven. Check for Chapter six: does require run the file twice?
Eight. Check for Chapter Seven: a countdown that keeps its place
Nine. Check for Chapter Eight: what the host sees
Chapter Eight: Embedding and Synthesis