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.

Local Declarations

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

2017-02-21 04:11:44
Assignment

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

2017-02-21 04:10:15
Chunks

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

2017-02-21 04:10:23
Control Structures

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

2017-02-21 04:10:29
Function Calls as Statements

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

2017-02-21 04:11:11
For Statement

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

2017-02-21 04:11:07
Blocks

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

2017-02-21 04:10:21