lua-users home
lua-l archive

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


> Neither FORPREP or FORLOOP actually references the loop index, so 
> how do they know what variable to reference?

They are on the top of the stack (Lua 4.0).


> I suspect that some information is being left on the stack, since 
> 'break' generates a POP 3 before the JMP.

Right. The pop removes the index, the step, and the limit.


> Oddly enough, a RETURN from a function from within several loops also
> only generates a POP 3, instead of a POP 6. Curious...

It should generate no pops (?). A return does not need to pop anything,
because when the function returns its whole stack slice will be removed.

-- Roberto