lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Note that p (the control variable) is changed in the body
of the for loop, and this works fine in pure Lua.
Well, it shouldn't. Modifying the control variables of a for loop only affects the copy of that variable within the for loop body - not the variable which is passed back into the iteration function (similarly with a numeric for, the control variable is shadowed within the loop body).

Also odd is your use of brackets in Lua return statements. This is invalid in vanilla Lua, and misleading if made valid, as a bracketed _expression_ normally produces exactly one value.