lua-users home
lua-l archive

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


> > "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
probably suffice?

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...
Bruce