diff options
Diffstat (limited to 'src/deep.cpp')
-rw-r--r-- | src/deep.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/deep.cpp b/src/deep.cpp index 1685ebb..51c9250 100644 --- a/src/deep.cpp +++ b/src/deep.cpp | |||
@@ -184,7 +184,7 @@ void DeepFactory::DeleteDeepObject(lua_State* L_, DeepPrelude* o_) | |||
184 | * used in this Lua state (metatable, registring it). Otherwise, increments the | 184 | * used in this Lua state (metatable, registring it). Otherwise, increments the |
185 | * reference count. | 185 | * reference count. |
186 | */ | 186 | */ |
187 | char const* DeepFactory::PushDeepProxy(DestState L_, DeepPrelude* prelude_, int nuv_, LookupMode mode_) | 187 | std::string_view DeepFactory::PushDeepProxy(DestState L_, DeepPrelude* prelude_, int nuv_, LookupMode mode_) |
188 | { | 188 | { |
189 | // Check if a proxy already exists | 189 | // Check if a proxy already exists |
190 | kDeepProxyCacheRegKey.getSubTableMode(L_, "v"); // L_: DPC | 190 | kDeepProxyCacheRegKey.getSubTableMode(L_, "v"); // L_: DPC |
@@ -192,7 +192,7 @@ char const* DeepFactory::PushDeepProxy(DestState L_, DeepPrelude* prelude_, int | |||
192 | lua_rawget(L_, -2); // L_: DPC proxy | 192 | lua_rawget(L_, -2); // L_: DPC proxy |
193 | if (!lua_isnil(L_, -1)) { | 193 | if (!lua_isnil(L_, -1)) { |
194 | lua_remove(L_, -2); // L_: proxy | 194 | lua_remove(L_, -2); // L_: proxy |
195 | return nullptr; | 195 | return std::string_view{}; |
196 | } else { | 196 | } else { |
197 | lua_pop(L_, 1); // L_: DPC | 197 | lua_pop(L_, 1); // L_: DPC |
198 | } | 198 | } |
@@ -264,18 +264,18 @@ char const* DeepFactory::PushDeepProxy(DestState L_, DeepPrelude* prelude_, int | |||
264 | lua_pushfstring(L_, "error while requiring '%s' identified by DeepFactory::moduleName: ", _modname.data()); | 264 | lua_pushfstring(L_, "error while requiring '%s' identified by DeepFactory::moduleName: ", _modname.data()); |
265 | lua_insert(L_, -2); // L_: DPC proxy metatable prefix error | 265 | lua_insert(L_, -2); // L_: DPC proxy metatable prefix error |
266 | lua_concat(L_, 2); // L_: DPC proxy metatable error | 266 | lua_concat(L_, 2); // L_: DPC proxy metatable error |
267 | return lua_tostring(L_, -1); | 267 | return lua_tostringview(L_, -1); |
268 | } | 268 | } |
269 | } else { // already loaded, we are happy | 269 | } else { // already loaded, we are happy |
270 | lua_pop(L_, 4); // L_: DPC proxy metatable | 270 | lua_pop(L_, 4); // L_: DPC proxy metatable |
271 | } | 271 | } |
272 | } else { // no L.registry._LOADED; can this ever happen? | 272 | } else { // no L.registry._LOADED; can this ever happen? |
273 | lua_pop(L_, 6); // L_: | 273 | lua_pop(L_, 6); // L_: |
274 | return "unexpected error while requiring a module identified by DeepFactory::moduleName"; | 274 | return std::string_view{ "unexpected error while requiring a module identified by DeepFactory::moduleName" }; |
275 | } | 275 | } |
276 | } else { // a module name, but no require() function :-( | 276 | } else { // a module name, but no require() function :-( |
277 | lua_pop(L_, 4); // L_: | 277 | lua_pop(L_, 4); // L_: |
278 | return "lanes receiving deep userdata should register the 'package' library"; | 278 | return std::string_view{ "lanes receiving deep userdata should register the 'package' library" }; |
279 | } | 279 | } |
280 | } | 280 | } |
281 | } | 281 | } |
@@ -291,7 +291,7 @@ char const* DeepFactory::PushDeepProxy(DestState L_, DeepPrelude* prelude_, int | |||
291 | lua_remove(L_, -2); // L_: proxy | 291 | lua_remove(L_, -2); // L_: proxy |
292 | LUA_ASSERT(L_, lua_type_as_enum(L_, -1) == LuaType::USERDATA); | 292 | LUA_ASSERT(L_, lua_type_as_enum(L_, -1) == LuaType::USERDATA); |
293 | STACK_CHECK(L_, 0); | 293 | STACK_CHECK(L_, 0); |
294 | return nullptr; | 294 | return std::string_view{}; |
295 | } | 295 | } |
296 | 296 | ||
297 | // ################################################################################################# | 297 | // ################################################################################################# |
@@ -336,9 +336,9 @@ int DeepFactory::pushDeepUserdata(DestState L_, int nuv_) const | |||
336 | raise_luaL_error(L_, "Bad DeepFactory::newDeepObjectInternal overload: should not push anything on the stack"); | 336 | raise_luaL_error(L_, "Bad DeepFactory::newDeepObjectInternal overload: should not push anything on the stack"); |
337 | } | 337 | } |
338 | 338 | ||
339 | char const* const _err{ DeepFactory::PushDeepProxy(L_, _prelude, nuv_, LookupMode::LaneBody) }; // proxy | 339 | std::string_view const _err{ DeepFactory::PushDeepProxy(L_, _prelude, nuv_, LookupMode::LaneBody) }; // proxy |
340 | if (_err != nullptr) { | 340 | if (!_err.empty()) { |
341 | raise_luaL_error(L_, _err); | 341 | raise_luaL_error(L_, _err.data()); |
342 | } | 342 | } |
343 | STACK_CHECK(L_, 1); | 343 | STACK_CHECK(L_, 1); |
344 | return 1; | 344 | return 1; |