This section describes the lexis, the syntax, and the semantics of Lua. In other words, this section describes which tokens are valid, how they can be combined, and what their combinations mean.

The language constructs will be explained using the usual extended BNF notation, in which {_a_} means 0 or more _a_'s, and [a] means an optional a. Non-terminals are shown like non-terminal, keywords are shown like kword, and other terminal symbols are shown like `*=*`. The complete syntax of Lua can be found at the end of this manual.


  1. Lexical Conventions
  2. Values and Types
  3. Variables
  4. Statements
  5. Expressions
  6. Visibility Rules
  7. Error Handling
  8. Metatables
  9. Environments
  10. Garbage Collection
  11. Coroutines