[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: the gc
- From: "D Burgess" <dburgess@...>
- Date: Fri, 11 Aug 2006 21:32:03 +1000
. It is a bit confusing maybe...
Ok I am confused. The LUA_ENVIRONINDEX according to the manual is
"The environment of the running C function is always at pseudo-index
LUA_ENVIRONINDEX." (You will note that this the one refernce to it in
Given that the code never sets LUA_ENVIRONINDEX I assume
that it is equal to LUA_GLOBALINDEX.
In this case it was a running *Lua* function in another thread..
> lua_setfenv(L1, funix); /* remove reference to env */
> It would seem that this also set the environment of the function in
> *all* executing threads.
Yes, that's what it is intended to do: change the environment of the
*executing* C function. To change the environment use lua_replace(L1,
LUA_ENVIRONINDEX). It is a bit confusing maybe...