lua-users home
lua-l archive

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


Hi,

Jean Claude Morlier wrote:
> In the example above I try to assign my own globals but this don't work.
> I need to set for a time myGlobals and after restore initial globals.
> May be I don't do this in a fine way.

You just forgot to copy "tostring".  It's used internally by print.
So print tries to call nil and by thus raises an error.  And because
you didn't have an _ERRORMESSAGE and _ALERT you don't see this error.

To get it working just insert:

	l.tostring = tostring		-- converts print-args to strings

and to see error messages

	l._ERRORMESSAGE = _ERRORMESSAGE	-- generates error message
	l._ALERT = _ALERT		-- actually prints the message

Ciao, ET.

PS: The for statement does not need the next function.