From eae02827ca659a25949c212d8e53dd4334df32d0 Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Tue, 27 Nov 2018 15:39:25 +0100 Subject: replace hardcoded "_LOADED" with lua-provided LUA_LOADED_TABLE --- src/compat.c | 2 +- src/deep.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/compat.c b/src/compat.c index 1a66f38..c5e29f5 100644 --- a/src/compat.c +++ b/src/compat.c @@ -30,7 +30,7 @@ void luaL_requiref (lua_State *L, const char *modname, lua_CFunction openf, int lua_pushcfunction(L, openf); lua_pushstring(L, modname); /* argument to open function */ lua_call(L, 1, 1); /* open module */ - luaL_getsubtable(L, LUA_REGISTRYINDEX, "_LOADED"); + luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE); lua_pushvalue(L, -2); /* make copy of module (call result) */ lua_setfield(L, -2, modname); /* _LOADED[modname] = module */ lua_pop(L, 1); /* remove _LOADED table */ diff --git a/src/deep.c b/src/deep.c index a486a72..fd92e0c 100644 --- a/src/deep.c +++ b/src/deep.c @@ -347,13 +347,13 @@ char const* push_deep_proxy( Universe* U, lua_State* L, DeepPrelude* prelude, Lo } if( NULL != modname) // we actually got a module name { - // somehow, L.registry._LOADED can exist without having registered the 'package' library. + // L.registry._LOADED exists without having registered the 'package' library. lua_getglobal( L, "require"); // DPC proxy metatable require() // check that the module is already loaded (or being loaded, we are happy either way) if( lua_isfunction( L, -1)) { lua_pushstring( L, modname); // DPC proxy metatable require() "module" - lua_getfield( L, LUA_REGISTRYINDEX, "_LOADED"); // DPC proxy metatable require() "module" _R._LOADED + lua_getfield( L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE); // DPC proxy metatable require() "module" _R._LOADED if( lua_istable( L, -1)) { bool_t alreadyloaded; -- cgit v1.2.3-55-g6feb