lua-users home
lua-l archive

Re: setfenv on userdata

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


On Wed, 2005年08月24日 at 10:25 -0300, Roberto Ierusalimschy wrote:
> On the other hand, it would be strange to allow nil environments in
> userdata but not in other types. And it would make setfenv/getfenv
> more complex.
On the topic of strange behaviour wrt. environments...
I was more than a little surprised to find that while
GETGLOBAL/SETGLOBAL opcodes use the environment, the lua_getglobal and
lua_setglobal macros use LUA_GLOBALSINDEX rather than LUA_ENVIRONINDEX.
Is this deliberate, should I be using LUA_ENVIRONINDEX explicitly?
Confusedly yours...
D.
-- 
Daniel Silverstone http://www.digital-scurf.org/
PGP mail accepted and encouraged. Key Id: 2BC8 4016 2068 7895

AltStyle によって変換されたページ (->オリジナル) /