[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: The purpose of LUA_ENVIRONINDEX pseudo index
- From: Jose Luis Hidalgo Valiño <joseluis.hidalgo@...>
- Date: Fri, 25 Aug 2006 09:05:40 +0200
Hi All! ,
I'm not sure to completely understand the purpose of the
LUA_ENVIRONINDEX pseudo index. This is new to lua 5.1 and is the
pseudo index to access the environment of the running C function. Ok,
is this the global table of the running C function ? is by default
the same as the LUA_GLOBALSINDEX if not changed by a lua_setfenv ?
Should we use it by default instead of LUA_GLOBALSINDEX (it is more
correct to try access the current environment)? is LUA_GLOBALSINDEX a
way to always access the thread environment ignoring a lua_setfenv ?
Can anybody give an example where the lua_environment is useful, or
an example where lua_globalsindex can not be used? For example, could
lua_environindex be used to hold data locally( or private ) to a C
function that can be accessed in successive calls?
Thank you!
PpluX