diff options
-rw-r--r-- | src/state.cpp | 17 |
1 files changed, 4 insertions, 13 deletions
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 { | |||
46 | // ############################################################################################# | 46 | // ############################################################################################# |
47 | // ############################################################################################# | 47 | // ############################################################################################# |
48 | 48 | ||
49 | [[nodiscard]] static int require_lanes_core(lua_State* const L_) | ||
50 | { | ||
51 | // leaves a copy of 'lanes.core' module table on the stack | ||
52 | luaL_requiref(L_, kLanesCoreLibName, luaopen_lanes_core, 0); | ||
53 | return 1; | ||
54 | } | ||
55 | |||
56 | // ############################################################################################# | ||
57 | |||
58 | namespace local { | 49 | namespace local { |
59 | static luaL_Reg const sLibs[] = { | 50 | static luaL_Reg const sLibs[] = { |
60 | { "base", nullptr }, // ignore "base" is always valid, but opened separately | 51 | { "base", nullptr }, // ignore "base" is always valid, but opened separately |
@@ -89,7 +80,7 @@ namespace { | |||
89 | { LUA_JITLIBNAME, luaopen_jit }, | 80 | { LUA_JITLIBNAME, luaopen_jit }, |
90 | #endif // LUAJIT_FLAVOR() != 0 | 81 | #endif // LUAJIT_FLAVOR() != 0 |
91 | 82 | ||
92 | { kLanesCoreLibName, require_lanes_core } // So that we can open it like any base library (possible since we have access to the init function) | 83 | { kLanesCoreLibName, luaopen_lanes_core } // So that we can open it like any base library (possible since we have access to the init function) |
93 | }; | 84 | }; |
94 | 85 | ||
95 | } // namespace local | 86 | } // namespace local |
@@ -108,10 +99,10 @@ namespace { | |||
108 | DEBUGSPEW_CODE(DebugSpew(Universe::Get(L_)) << "opening '" << _name << "' library" << std::endl); | 99 | DEBUGSPEW_CODE(DebugSpew(Universe::Get(L_)) << "opening '" << _name << "' library" << std::endl); |
109 | STACK_CHECK_START_REL(L_, 0); | 100 | STACK_CHECK_START_REL(L_, 0); |
110 | // open the library as if through require(), and create a global as well if necessary (the library table is left on the stack) | 101 | // open the library as if through require(), and create a global as well if necessary (the library table is left on the stack) |
111 | bool const isLanesCore{ _libfunc == require_lanes_core }; // don't want to create a global for "lanes.core" | 102 | bool const _isLanesCore{ _libfunc == luaopen_lanes_core }; // don't want to create a global for "lanes.core" |
112 | luaL_requiref(L_, _name.data(), _libfunc, !isLanesCore); // L_: {lib} | 103 | luaL_requiref(L_, _name.data(), _libfunc, !_isLanesCore); // L_: {lib} |
113 | // lanes.core doesn't declare a global, so scan it here and now | 104 | // lanes.core doesn't declare a global, so scan it here and now |
114 | if (isLanesCore) { | 105 | if (_isLanesCore) { |
115 | tools::PopulateFuncLookupTable(L_, -1, _name); | 106 | tools::PopulateFuncLookupTable(L_, -1, _name); |
116 | } | 107 | } |
117 | lua_pop(L_, 1); // L_: | 108 | lua_pop(L_, 1); // L_: |