• Comprehensive Lua
  • Comprehensive Lua
  • 1. Introduction to Lua
    • 1.1. History
    • 1.2. Goals
    • 1.3. References and Tutorials
    • 1.4. Installing an IDE
    • 1.5. LuaRocks
  • 2. Basic syntax and semantics
    • 2.1. Identifiers
    • 2.2. Types
    • 2.3. More on Strings
    • 2.4. Tables
    • 2.5. Comments
    • 2.6. Expressions and Statements
    • 2.7. Global Variables
    • 2.8. Local Variables
  • 3. Basic control structures
    • 3.1. The while and repeat loops
    • 3.2. The for loop
    • 3.3. Generic for loop
    • 3.4. Conditionals if then elseif else end
    • 3.5. Using break return and goto
    • 3.6. Using do end to delimit blocks
    • 3.7. Exercise on Control Structures
  • 4. Functions
    • 4.1. Variadic Functions
    • 4.2. Returning multiple results
    • 4.3. Exercise on Functions
    • 4.4. Named Arguments
    • 4.5. Closures
    • 4.6. Exercise on Closures
    • 4.7. Tail Calls
    • 4.8. Exercise on Functions (Polynomial Evaluation)
  • 5. Data Structures Using Tables
    • 5.1. Tables in Lua
    • 5.2. Arrays
    • 5.3. Multi-Dimensional Arrays
    • 5.4. Linked Lists
    • 5.5. Stacks
    • 5.6. Exercise on Stacks
    • 5.7. Queues
    • 5.8. Sets
    • 5.9. String Buffer
    • 5.10. Graphs
    • 5.11. Exercise on Graphs (Work in teams)
    • 5.12. Tables as Objects
  • 6. Errors and Error handling
    • 6.1. Stop the program on major errors
    • 6.2. Catch and handle errors when appropriate
    • 6.3. Give a stack trace with the error message
  • 7. Iterators
    • 7.1. The generic for loop
    • 7.2. Stateless vs stateful iterators
    • 7.3. Exercise on Iterators
  • 8. Coroutines
    • 8.1. Producer Consumer Example
  • 9. Metatables and metamethods
    • 9.1. Arithmetic Metamethods
    • 9.2. Relational Metamethods
    • 9.3. Library and Table Access Metamethods
  • 10. Modules and packages
    • 10.1. Using Modules
    • 10.2. How are modules Loaded
    • 10.3. Creating Modules
    • 10.4. Organizing modules into packages
  • 11. Metatables through examples
    • 11.1. Default Values for Tables
    • 11.2. Exercise on Default Values
    • 11.3. Proxies
    • 11.4. Exercise on Proxies
    • 11.5. Read Only Tables
    • 11.6. Memoization
  • 12. Environments
    • 12.1. Declaring Global Variables
    • 12.2. Relationship between global variables and environments
    • 12.3. The _ENV table and the _G table
    • 12.4. Classes
  • 13. Object-oriented Programming
    • 13.1. Inheritance
    • 13.2. Exercise on Object Oriented Programming
  • 14. A walkthrough of the Lua Standard Libraries
    • 14.1. Base Library
    • 14.2. I/O Library
    • 14.3. Table Library
    • 14.4. String Library
    • 14.5. Exercise using Strings and Pattern Matching (in teams of three)
    • 14.6. The Operating System Library
  • 15. Compilation
  • 16. Garbage collection
    • 16.1. Finalizers
    • 16.2. Weak Tables
  • 17. Lua bytecode and virtual machine
  • 18. Calling C modules from Lua
    • 18.1. LuaRocks
    • 18.2. Exercise Setting up LuaRocks within LDT
    • 18.3. Networking with Coroutines Example using LuaSockets
    • 18.4. Exercise on LuaSockets
  • 19. Create C Modules, Call from Lua
  • 20. Calling Lua from C
    • 20.1. The Stack
    • 20.2. Exercise on the Stack
    • 20.3. Accessing Lua Tables from C
    • 20.4. Accessing Functions through the Stack
    • 20.5. Continuations
  • 21. Memory management
  • 22. Threads in Lua
  • 23. Sample Lua and C code
Powered by GitBook

Comprehensive Lua

References and Tutorials

  • Wikipedia on Lua
  • The Lua website
  • Lua Documentation
  • Lua Tutorial at TutorialsPoint
  • Lua.org tutorial
  • Lua Tutorial at luatut
  • Lua Tutorial Directory at lua-users.org
  • Examples of Lua code at Gammon.com
  • Main Directory at lua-users.org

  • Quick Reference Card for Lua

  • Lua-users.org on Lua Quick Cards
  • Lua Short Reference