diff options
Diffstat (limited to 'src/deep.cpp')
-rw-r--r-- | src/deep.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/deep.cpp b/src/deep.cpp index 51c9250..f23f0be 100644 --- a/src/deep.cpp +++ b/src/deep.cpp | |||
@@ -224,7 +224,7 @@ std::string_view DeepFactory::PushDeepProxy(DestState L_, DeepPrelude* prelude_, | |||
224 | return "Bad DeepFactory::createMetatable overload: unexpected pushed value"; | 224 | return "Bad DeepFactory::createMetatable overload: unexpected pushed value"; |
225 | } | 225 | } |
226 | // if the metatable contains a __gc, we will call it from our own | 226 | // if the metatable contains a __gc, we will call it from our own |
227 | lua_getfield(L_, -1, "__gc"); // L_: DPC proxy metatable __gc | 227 | std::ignore = luaG_getfield(L_, -1, "__gc"); // L_: DPC proxy metatable __gc |
228 | } else { | 228 | } else { |
229 | // keepers need a minimal metatable that only contains our own __gc | 229 | // keepers need a minimal metatable that only contains our own __gc |
230 | lua_createtable(L_, 0, 1); // L_: DPC proxy metatable | 230 | lua_createtable(L_, 0, 1); // L_: DPC proxy metatable |
@@ -250,12 +250,11 @@ std::string_view DeepFactory::PushDeepProxy(DestState L_, DeepPrelude* prelude_, | |||
250 | // check that the module is already loaded (or being loaded, we are happy either way) | 250 | // check that the module is already loaded (or being loaded, we are happy either way) |
251 | if (lua_isfunction(L_, -1)) { | 251 | if (lua_isfunction(L_, -1)) { |
252 | lua_pushlstring(L_, _modname.data(), _modname.size()); // L_: DPC proxy metatable require() "module" | 252 | lua_pushlstring(L_, _modname.data(), _modname.size()); // L_: DPC proxy metatable require() "module" |
253 | lua_getfield(L_, LUA_REGISTRYINDEX, LUA_LOADED_TABLE); // L_: DPC proxy metatable require() "module" _R._LOADED | 253 | if (luaG_getfield(L_, LUA_REGISTRYINDEX, LUA_LOADED_TABLE) == LuaType::TABLE) { // L_: DPC proxy metatable require() "module" _R._LOADED |
254 | if (lua_istable(L_, -1)) { | ||
255 | lua_pushvalue(L_, -2); // L_: DPC proxy metatable require() "module" _R._LOADED "module" | 254 | lua_pushvalue(L_, -2); // L_: DPC proxy metatable require() "module" _R._LOADED "module" |
256 | lua_rawget(L_, -2); // L_: DPC proxy metatable require() "module" _R._LOADED module | 255 | lua_rawget(L_, -2); // L_: DPC proxy metatable require() "module" _R._LOADED module |
257 | int const alreadyloaded = lua_toboolean(L_, -1); | 256 | int const _alreadyloaded{ lua_toboolean(L_, -1) }; |
258 | if (!alreadyloaded) { // not loaded | 257 | if (!_alreadyloaded) { // not loaded |
259 | lua_pop(L_, 2); // L_: DPC proxy metatable require() "module" | 258 | lua_pop(L_, 2); // L_: DPC proxy metatable require() "module" |
260 | // require "modname" | 259 | // require "modname" |
261 | LuaError const _require_result{ lua_pcall(L_, 1, 0, 0) }; // L_: DPC proxy metatable error? | 260 | LuaError const _require_result{ lua_pcall(L_, 1, 0, 0) }; // L_: DPC proxy metatable error? |