Programming in Lua Notes
Patrick M. Elsen
Contents
Programming in Lua Notes 2
Iterators and the Generic for 6
Compilation, Execution and Errors 7
Object-Oriented Programming 14
Weak Tables 16
Finalizers 16
The Operating System Library 21
Calling a Lua function from C 24
C Functions 25
C Modules 26
Techniques for Writing C Functions 26
Storing State in C Functions 28
Programming in Lua NotesGetting StartedTypes and ValuesExpressionsStatementsFunctionsMore about FunctionsIterators and the Generic forCompilation, Execution and ErrorsCoroutinesComplete ExamplesData StructuresData Files and PersistenceMetatables and MetamethodsThe EnvironmentModules and PackagesObject-Oriented ProgrammingWeak Tables and FinalizersWeak TablesFinalizersThe Mathematical LibraryThe Bitwise LibraryThe Table LibraryThe String LibraryThe I/O LibraryThe Simple I/O ModelThe Complete I/O ModelThe Operating System LibraryThe Debug LibraryAn Overview of the C APIAbout the C APIThe Header FilesExtending Your ApplicationCalling a Lua function from CCalling C from LuaC FunctionsContinuationsC ModulesTechniques for Writing C FunctionsArray ManipulationString ManipulationStoring State in C FunctionsUser-Defined Types in CMemory ManagementMemory AllocationThe Garbage Collector