lua-users home
lua-l archive

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


I forgot to mention the obvious, that multiple GOSUB levels can easily be added by using 'table.insert()' with __retline. And I am _not_ taking this very seriously, merely as a hackable challenge. Over and out.


13.9.2004 kello 22:05, Rici Lake kirjoitti:

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.. :(


As long as we're retrofitting Lua here, what about <> ?

The expressiveness of the last example is very hard to match.