Local Declarations
Local Declarations
Local variables may be declared anywhere inside a block. The declaration may include an initial assignment (which may be a multiple assignment.) Otherwise, all variables are initialized with nil .
local NAME {, NAME} [= EXPLIST]
A chunk is also a block, and so local variables can be declared outside any explicit block. The scope of local variables begins after the declaration and lasts until the end of the block.