lua-users home
lua-l archive

Re: Implementing GOTO/GOSUB

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


On 13-Sep-04, at 1:36 PM, Asko Kauppi wrote:
Okay, here's a more polished version (still, not tried). If someone uses it, make sure cpp doesn't add #pragma's or other such stuff in its output (I've used 'cpp -P -xassembler-with-cpp').
	local __retline
#define __GOSUB(xx) __retline='#'.. #__LINE__; __GOTO=xx; __LABEL='#'.. #__LINE__
	#define __RETURN __GOTO=__retline
I know that the '__GOSUB()' syntax and '__GOTO=' syntaxes are nastily different; don't know a fix for this.. :(
-ak
As long as we're retrofitting Lua here, what about <http://www.fortran.com/fortran/come_from.html> ?
The expressiveness of the last example is very hard to match.
Rici
:)

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