lua-users home
lua-l archive

for-statement with a global iterator

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


Hi,
for compatibility with my old scripting language which I want to replace
with Lua, the for-statement needs to use a global iterating variable.
With the current Lua implementation, the variable is only valid within
the loop.
Can someone point me in a direction how to solve this problem in
an elegant way? I thought about leaving the things as they are (i.e.
three local variables in forstat() ) but calling SETGLOBAL in each
OP_FOR operation. But I don't know how to pass the info of the
global variable to OP_FOR. The opcode field space is already used for
the references to the three locals and the beginning of the for-block.
Thanks for any help!
Andreas

AltStyle によって変換されたページ (->オリジナル) /