Assignment
Assignment
Lua allows multiple assignment. The syntax for assignment defines a list of variables on the left side and a list of expressions on the right side:
VARLIST = EXPLIST
VAR { , VAR } = EXP { , EXP }
Lua first evaluates all values on the right side and then makes the assignments. Thus,mul exchange two or more values:
VAR1, VAR2 = VAR2 , VAR1
If the two lists have different lengths, an adjustment is made before assignment.