[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Implementing GOTO/GOSUB
- From: Asko Kauppi <asko.kauppi@...>
- Date: Mon, 13 Sep 2004 20:41:15 +0300
Well, you can emulate GOSUBs with GOTO, can't you.. (just conceptually,
__GOSUB=xx: __RETURN_TO='#'..linenum; __GOTO=xx; __LABEL='#'..linenum
This would probably need the use of C preprocessor (cpp) or something
alike to do the macros (& get the linenums!). Is that out of the
13.9.2004 kello 20:13, Luiz Henrique de Figueiredo kirjoitti:
I tried to implement GOTO/GOSUB functionality in Lua.
An year ago, prompted by a similar request here in lua-l, I wrote a
patch for luac that did the right thing for the code below:
do return end
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