lua-users home
lua-l archive

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


> I tried to implement GOTO/GOSUB functionality in Lua.

An year ago, prompted by a similar request here in lua-l, I wrote a simple
patch for luac that did the right thing for the code below:

         a=1
         __GOTO=12
         __LABEL=99
         print("bye",a)
         do return end
         a=2
         __LABEL=12
         print("hello",a)
         a=3
         __GOTO=99

That is, it turned __GOTO into JMPs and __LABEL into NOPS.
This worked great for GOTO but I don't think it will work for GOSUB ... RETURN.
--lhf