[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: struggling Lua globals..
- From: "Bruce Dodson" <bruce_dodson@...>
- Date: Sun, 4 Jul 2004 22:21:14 -0300
> > "require" needs "LUA_PATH" and "_LOADED"
> LUA_PATH is optional. _LOADED is used "read-only", so require could
> keep a private reference to it?
If it is a private reference, there still needs to be a mechanism for the C
API to access and/or replace that table, even if it's not readily exposed to
script. If it were stored at a documented upvalue index, that would
OTOH maybe it's good that _LOADED is in the global scope, since the objects
published by the loaded module also go in the global scope. Clear globals,
and both are cleared (but, reset globals and then call luaopen_base would
also create a new closure with a new _LOADED upvalue, so maybe the
separation is not important).
Just a thought...