From 1029bf5bcc7c2bb506ddc02a78a12c6993680413 Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Wed, 26 Jun 2024 12:16:07 +0200 Subject: Fix (harmless) bad internal usage of luaopen_lanes_core --- src/state.cpp | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/state.cpp b/src/state.cpp index b50d135..322def8 100644 --- a/src/state.cpp +++ b/src/state.cpp @@ -46,15 +46,6 @@ namespace { // ############################################################################################# // ############################################################################################# - [[nodiscard]] static int require_lanes_core(lua_State* const L_) - { - // leaves a copy of 'lanes.core' module table on the stack - luaL_requiref(L_, kLanesCoreLibName, luaopen_lanes_core, 0); - return 1; - } - - // ############################################################################################# - namespace local { static luaL_Reg const sLibs[] = { { "base", nullptr }, // ignore "base" is always valid, but opened separately @@ -89,7 +80,7 @@ namespace { { LUA_JITLIBNAME, luaopen_jit }, #endif // LUAJIT_FLAVOR() != 0 - { kLanesCoreLibName, require_lanes_core } // So that we can open it like any base library (possible since we have access to the init function) + { kLanesCoreLibName, luaopen_lanes_core } // So that we can open it like any base library (possible since we have access to the init function) }; } // namespace local @@ -108,10 +99,10 @@ namespace { DEBUGSPEW_CODE(DebugSpew(Universe::Get(L_)) << "opening '" << _name << "' library" << std::endl); STACK_CHECK_START_REL(L_, 0); // open the library as if through require(), and create a global as well if necessary (the library table is left on the stack) - bool const isLanesCore{ _libfunc == require_lanes_core }; // don't want to create a global for "lanes.core" - luaL_requiref(L_, _name.data(), _libfunc, !isLanesCore); // L_: {lib} + bool const _isLanesCore{ _libfunc == luaopen_lanes_core }; // don't want to create a global for "lanes.core" + luaL_requiref(L_, _name.data(), _libfunc, !_isLanesCore); // L_: {lib} // lanes.core doesn't declare a global, so scan it here and now - if (isLanesCore) { + if (_isLanesCore) { tools::PopulateFuncLookupTable(L_, -1, _name); } lua_pop(L_, 1); // L_: -- cgit v1.2.3-55-g6feb