3.3 – Statements

Lua supports an almost conventional set of statements, similar to those in Pascal or C. This set includes assignments, control structures, function calls, and variable declarations.

Assignment
  • References/Lua/Lua/Language/Statements

3.3.3 – Assignment Lua allows multiple assignments. Therefore, the syntax for assignment defines a list of variables on the left side and a list of expressions on the right side. The elements

2025-01-10 15:47:30
Local Declarations
  • References/Lua/Lua/Language/Statements

3.3.7 – Local Declarations Local variables can be declared anywhere inside a block. The declaration can include an initial assignment: stat ::= local

2025-01-10 15:47:30
Chunks
  • References/Lua/Lua/Language/Statements

3.3.2 – Chunks The unit of compilation of Lua is called a chunk. Syntactically, a chunk is simply a block: chunk ::= block Lua

2025-01-10 15:47:30
Function Calls as Statements
  • References/Lua/Lua/Language/Statements

3.3.6 – Function Calls as Statements To allow possible side-effects, function calls can be executed as statements: stat ::= functioncall

2025-01-10 15:47:30
Control Structures
  • References/Lua/Lua/Language/Statements

3.3.4 – Control Structures The control structures if, while, and repeat have the usual meaning and familiar syntax: stat ::=

2025-01-10 15:47:30
Blocks
  • References/Lua/Lua/Language/Statements

3.3.1 – Blocks A block is a list of statements, which are executed sequentially: block ::= {stat} Lua has empty statements that

2025-01-10 15:47:30
For Statement
  • References/Lua/Lua/Language/Statements

3.3.5 – For Statement The for statement has two forms: one numerical and one generic. The numerical for loop repeats a block of code while a control variable runs through

2025-01-10 15:47:30