aboutsummaryrefslogtreecommitdiff
path: root/src/deep.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/deep.cpp')
-rw-r--r--src/deep.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/deep.cpp b/src/deep.cpp
index 2f4f1ed..5515a62 100644
--- a/src/deep.cpp
+++ b/src/deep.cpp
@@ -244,12 +244,12 @@ char const* DeepFactory::PushDeepProxy(DestState L_, DeepPrelude* prelude_, int
244 factory.storeDeepLookup(L_); 244 factory.storeDeepLookup(L_);
245 245
246 // 2 - cause the target state to require the module that exported the factory 246 // 2 - cause the target state to require the module that exported the factory
247 if (char const* const _modname{ factory.moduleName() }; _modname) { // we actually got a module name 247 if (std::string_view const _modname{ factory.moduleName() }; !_modname.empty()) { // we actually got a module name
248 // L.registry._LOADED exists without having registered the 'package' library. 248 // L.registry._LOADED exists without having registered the 'package' library.
249 lua_getglobal(L_, "require"); // DPC proxy metatable require() 249 lua_getglobal(L_, "require"); // L_: DPC proxy metatable require()
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_pushstring(L_, _modname); // 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 lua_getfield(L_, LUA_REGISTRYINDEX, LUA_LOADED_TABLE); // L_: DPC proxy metatable require() "module" _R._LOADED
254 if (lua_istable(L_, -1)) { 254 if (lua_istable(L_, -1)) {
255 lua_pushvalue(L_, -2); // L_: DPC proxy metatable require() "module" _R._LOADED "module" 255 lua_pushvalue(L_, -2); // L_: DPC proxy metatable require() "module" _R._LOADED "module"
@@ -262,7 +262,7 @@ char const* DeepFactory::PushDeepProxy(DestState L_, DeepPrelude* prelude_, int
262 require_result = lua_pcall(L_, 1, 0, 0); // L_: DPC proxy metatable error? 262 require_result = lua_pcall(L_, 1, 0, 0); // L_: DPC proxy metatable error?
263 if (require_result != LUA_OK) { 263 if (require_result != LUA_OK) {
264 // failed, return the error message 264 // failed, return the error message
265 lua_pushfstring(L_, "error while requiring '%s' identified by DeepFactory::moduleName: ", _modname); 265 lua_pushfstring(L_, "error while requiring '%s' identified by DeepFactory::moduleName: ", _modname.data());
266 lua_insert(L_, -2); // L_: DPC proxy metatable prefix error 266 lua_insert(L_, -2); // L_: DPC proxy metatable prefix error
267 lua_concat(L_, 2); // L_: DPC proxy metatable error 267 lua_concat(L_, 2); // L_: DPC proxy metatable error
268 return lua_tostring(L_, -1); 268 return lua_tostring(L_, -1);