[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: function kidnapping
- From: tomas@...
- Date: Mon, 8 May 2000 08:56:26 -0300 (EST)
> -- Assuming tag methods in place to allow swapping of global table via
> -- a function "setglobaltable".
> function wrapper(func, ...)
> local oldtable = setglobaltable(t)
> local val = call(func, arg)
> setglobaltable(oldtable)
> return val
> end
With this wrapper, when you swap the global table you'll loose
(while executing the function, of course) all global functions, like
print, gsub, write etc. I think it would be better not to change the
global environment but to check if the global exists. If it doesn't,
so try the local value.
Tomas