lua-users home
lua-l archive

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


Duh. I thought about something like that, but I hadn't realized that
imported C functions were referenced by globals as well, and as such were
subject to disappearance :-)
Thanks for your answers.

> -----Original Message-----
> From: Luiz Henrique de Figueiredo [mailto:lhf@tecgraf.puc-rio.br]
> Sent: mardi 2 juillet 2002 18:29
> To: Multiple recipients of list
> Subject: Re: newbie question: is globals() usable in practice ?
> 
> 
> >It looks like as soon as the globals table is swapped, 
> execution stops. Why
> >is that ? Is this a normal behaviour, and if so, what is the 
> practical use
> >of the globals() function ?
> 
> You've installed an *empty* table and so "print" and 
> "globals" are no longer
> defined in the new global table. You need at least this:
> 
> 	local t = {print=print, globals=globals}
> 
> (Also, save _ERRORMESSAGE and _ALERT in t if you want to see 
> any errors
> reported.)
> 
> Or you can setup "index" tag methods so that the new table 
> can inherit from
> the original global table.
> --lhf
>