[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Does LUA_ENVIRONINDEX make LUA_GLOBALSINDEX obsolete?
- From: Tim Maxwell <timmaxw@...>
- Date: Mon, 14 Jul 2008 21:49:48 -0700
Hi,
The environment system is a powerful new feature for Lua. It seems to
me that the globals table accessible through LUA_GLOBALSINDEX is just
a special case of the environment table - unless I am mistaken,
LUA_GLOBALSINDEX simply refers to the environment table that was
created for the first Lua state. If I'm wrong, disregard the rest of
this message.
Perhaps LUA_GLOBALSINDEX is unnecessary. lua_getglobal and
lua_setglobal could be redirected to access LUA_ENVIRONINDEX instead
of LUA_GLOBALSINDEX. Most global variable access should go to the
environment table anyway, so lua_getglobal and lua_setglobal would be
more useful if they want to the environment table. Other functions
that use LUA_GLOBALSINDEX should probably go to LUA_ENVIRONINDEX as
well.
Can anybody think of a use for LUA_GLOBALSINDEX over LUA_ENVIRONINDEX?
Is there anything that this change would break?
Is LUA_GLOBALSINDEX already being retired?
Tim Maxwell