Local Declarations

<< Click to Display Table of Contents >>

Navigation:  Modbus Universal MasterOPC Server > Lua 5.1 Reference Manual > The Language and syntax > Statements >

Local Declarations

Local Declarations

Local variables can be declared anywhere inside a block. The declaration can include an initial assignment:

local namelist=0 --this code declares a local variable and initializes it with 0

If present, an initial assignment has the same semantics of a multiple assignment (see Assignment ). Otherwise, all variables are initialized with nil.

The visibility rules for local variables are explained in Visibility Rules .