Local variables can be declared anywhere inside a block.
The declaration can include an initial assignment:
stat ::= local namelist [`=´ explist]
If present, an initial assignment has the same semantics
of a multiple assignment (see Assignment).
Otherwise, all variables are initialized with nil.
A chunk is also a block (see Chunks),
and so local variables can be declared in a chunk outside any explicit block.
The scope of such local variables extends until the end of the chunk.
The visibility rules for local variables are explained in Visibility Rules.