Re: Lua 5.2 - emulation of old setfenv
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Lua 5.2 - emulation of old setfenv
- From: Lorenzo Donati <lorenzodonatibz@...>
- Date: 2011年1月05日 19:35:20 +0100
Roberto Ierusalimschy wrote:
Sergey Rozhenko posted some time ago a pretty good implementation of
setfenv that handled most of those subtleties.
(http://lua-users.org/lists/lua-l/2010-06/msg00313.html)
Luiz:
Search the upvalues of the function looking for the one named _ENV.
If debug info has been stripped from the function, you're out of luck,
but that does not seem to be your case.
Thanks for the help! I'll try your suggestions.
By the way, wouldn't it be good to ease the transition to 5.2 to create
a place (lua.org? wiki?) where useful "compatibility" snippets/tricks
like that could be found easily?
Best Regards,
--
Lorenzo