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 an arithmetic progression. It has the following syntax:
stat ::= for Name ‘=’ exp ‘,’ exp [‘,’ exp] do block end
The block is repeated for name starting at the value of the first exp, until it passes the second exp by steps of the third exp. More precisely, a for statement like
for v = e1, e2, e3 do block end
is equival