diff options
author | Benoit Germain <bnt.germain@gmail.com> | 2018-11-27 15:39:25 +0100 |
---|---|---|
committer | Benoit Germain <bnt.germain@gmail.com> | 2018-11-27 15:39:25 +0100 |
commit | eae02827ca659a25949c212d8e53dd4334df32d0 (patch) | |
tree | dac3765850f77b58a0cc15292e91dc465ce1e110 /src | |
parent | 5323d25231d327bfbdf12e1fc077903383bf8739 (diff) | |
download | lanes-eae02827ca659a25949c212d8e53dd4334df32d0.tar.gz lanes-eae02827ca659a25949c212d8e53dd4334df32d0.tar.bz2 lanes-eae02827ca659a25949c212d8e53dd4334df32d0.zip |
replace hardcoded "_LOADED" with lua-provided LUA_LOADED_TABLE
Diffstat (limited to 'src')
-rw-r--r-- | src/compat.c | 2 | ||||
-rw-r--r-- | src/deep.c | 4 |
2 files changed, 3 insertions, 3 deletions
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 | |||
30 | lua_pushcfunction(L, openf); | 30 | lua_pushcfunction(L, openf); |
31 | lua_pushstring(L, modname); /* argument to open function */ | 31 | lua_pushstring(L, modname); /* argument to open function */ |
32 | lua_call(L, 1, 1); /* open module */ | 32 | lua_call(L, 1, 1); /* open module */ |
33 | luaL_getsubtable(L, LUA_REGISTRYINDEX, "_LOADED"); | 33 | luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE); |
34 | lua_pushvalue(L, -2); /* make copy of module (call result) */ | 34 | lua_pushvalue(L, -2); /* make copy of module (call result) */ |
35 | lua_setfield(L, -2, modname); /* _LOADED[modname] = module */ | 35 | lua_setfield(L, -2, modname); /* _LOADED[modname] = module */ |
36 | lua_pop(L, 1); /* remove _LOADED table */ | 36 | lua_pop(L, 1); /* remove _LOADED table */ |
@@ -347,13 +347,13 @@ char const* push_deep_proxy( Universe* U, lua_State* L, DeepPrelude* prelude, Lo | |||
347 | } | 347 | } |
348 | if( NULL != modname) // we actually got a module name | 348 | if( NULL != modname) // we actually got a module name |
349 | { | 349 | { |
350 | // somehow, L.registry._LOADED can exist without having registered the 'package' library. | 350 | // L.registry._LOADED exists without having registered the 'package' library. |
351 | lua_getglobal( L, "require"); // DPC proxy metatable require() | 351 | lua_getglobal( L, "require"); // DPC proxy metatable require() |
352 | // check that the module is already loaded (or being loaded, we are happy either way) | 352 | // check that the module is already loaded (or being loaded, we are happy either way) |
353 | if( lua_isfunction( L, -1)) | 353 | if( lua_isfunction( L, -1)) |
354 | { | 354 | { |
355 | lua_pushstring( L, modname); // DPC proxy metatable require() "module" | 355 | lua_pushstring( L, modname); // DPC proxy metatable require() "module" |
356 | lua_getfield( L, LUA_REGISTRYINDEX, "_LOADED"); // DPC proxy metatable require() "module" _R._LOADED | 356 | lua_getfield( L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE); // DPC proxy metatable require() "module" _R._LOADED |
357 | if( lua_istable( L, -1)) | 357 | if( lua_istable( L, -1)) |
358 | { | 358 | { |
359 | bool_t alreadyloaded; | 359 | bool_t alreadyloaded; |