diff options
Diffstat (limited to 'src/state.cpp')
-rw-r--r-- | src/state.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/state.cpp b/src/state.cpp index 08ed111..7ce8db0 100644 --- a/src/state.cpp +++ b/src/state.cpp | |||
@@ -84,11 +84,11 @@ THE SOFTWARE. | |||
84 | /* | 84 | /* |
85 | * Serialize calls to 'require', if it exists | 85 | * Serialize calls to 'require', if it exists |
86 | */ | 86 | */ |
87 | void serialize_require(DEBUGSPEW_PARAM_COMMA(Universe* U_) lua_State* L_) | 87 | void serialize_require(lua_State* L_) |
88 | { | 88 | { |
89 | STACK_GROW(L_, 1); | 89 | STACK_GROW(L_, 1); |
90 | STACK_CHECK_START_REL(L_, 0); | 90 | STACK_CHECK_START_REL(L_, 0); |
91 | DEBUGSPEW_CODE(DebugSpew(U_) << "serializing require()" << std::endl); | 91 | DEBUGSPEW_CODE(DebugSpew(universe_get(L_)) << "serializing require()" << std::endl); |
92 | 92 | ||
93 | // Check 'require' is there and not already wrapped; if not, do nothing | 93 | // Check 'require' is there and not already wrapped; if not, do nothing |
94 | // | 94 | // |
@@ -155,7 +155,7 @@ namespace global | |||
155 | 155 | ||
156 | // ################################################################################################# | 156 | // ################################################################################################# |
157 | 157 | ||
158 | static void open1lib(DEBUGSPEW_PARAM_COMMA(Universe* U_) lua_State* L_, std::string_view const& name_) | 158 | static void open1lib(lua_State* L_, std::string_view const& name_) |
159 | { | 159 | { |
160 | for (luaL_Reg const& _entry : global::sLibs) { | 160 | for (luaL_Reg const& _entry : global::sLibs) { |
161 | if (name_ == _entry.name) { | 161 | if (name_ == _entry.name) { |
@@ -164,7 +164,7 @@ static void open1lib(DEBUGSPEW_PARAM_COMMA(Universe* U_) lua_State* L_, std::str | |||
164 | break; | 164 | break; |
165 | } | 165 | } |
166 | std::string_view const _name{ _entry.name }; | 166 | std::string_view const _name{ _entry.name }; |
167 | DEBUGSPEW_CODE(DebugSpew(U_) << "opening '" << _name << "' library" << std::endl); | 167 | DEBUGSPEW_CODE(DebugSpew(universe_get(L_)) << "opening '" << _name << "' library" << std::endl); |
168 | STACK_CHECK_START_REL(L_, 0); | 168 | STACK_CHECK_START_REL(L_, 0); |
169 | // open the library as if through require(), and create a global as well if necessary (the library table is left on the stack) | 169 | // open the library as if through require(), and create a global as well if necessary (the library table is left on the stack) |
170 | bool const isLanesCore{ _libfunc == require_lanes_core }; // don't want to create a global for "lanes.core" | 170 | bool const isLanesCore{ _libfunc == require_lanes_core }; // don't want to create a global for "lanes.core" |
@@ -352,12 +352,12 @@ lua_State* luaG_newstate(Universe* U_, SourceState from_, char const* libs_) | |||
352 | DEBUGSPEW_CODE(DebugSpew(U_) << "opening ALL standard libraries" << std::endl); | 352 | DEBUGSPEW_CODE(DebugSpew(U_) << "opening ALL standard libraries" << std::endl); |
353 | luaL_openlibs(_L); | 353 | luaL_openlibs(_L); |
354 | // don't forget lanes.core for regular lane states | 354 | // don't forget lanes.core for regular lane states |
355 | open1lib(DEBUGSPEW_PARAM_COMMA(U_) _L, kLanesCoreLibName); | 355 | open1lib(_L, kLanesCoreLibName); |
356 | libs_ = nullptr; // done with libs | 356 | libs_ = nullptr; // done with libs |
357 | } else { | 357 | } else { |
358 | #if LUAJIT_FLAVOR() != 0 // building against LuaJIT headers, always open jit | 358 | #if LUAJIT_FLAVOR() != 0 // building against LuaJIT headers, always open jit |
359 | DEBUGSPEW_CODE(DebugSpew(U_) << "opening 'jit' library" << std::endl); | 359 | DEBUGSPEW_CODE(DebugSpew(U_) << "opening 'jit' library" << std::endl); |
360 | open1lib(DEBUGSPEW_PARAM_COMMA(U_) _L, LUA_JITLIBNAME); | 360 | open1lib(_L, LUA_JITLIBNAME); |
361 | #endif // LUAJIT_FLAVOR() | 361 | #endif // LUAJIT_FLAVOR() |
362 | DEBUGSPEW_CODE(DebugSpew(U_) << "opening 'base' library" << std::endl); | 362 | DEBUGSPEW_CODE(DebugSpew(U_) << "opening 'base' library" << std::endl); |
363 | #if LUA_VERSION_NUM >= 502 | 363 | #if LUA_VERSION_NUM >= 502 |
@@ -385,12 +385,12 @@ lua_State* luaG_newstate(Universe* U_, SourceState from_, char const* libs_) | |||
385 | while (isalnum(_p[_len]) || _p[_len] == '.') | 385 | while (isalnum(_p[_len]) || _p[_len] == '.') |
386 | ++_len; | 386 | ++_len; |
387 | // open library | 387 | // open library |
388 | open1lib(DEBUGSPEW_PARAM_COMMA(U_) _L, { _p, _len }); | 388 | open1lib(_L, { _p, _len }); |
389 | } | 389 | } |
390 | } | 390 | } |
391 | lua_gc(_L, LUA_GCRESTART, 0); | 391 | lua_gc(_L, LUA_GCRESTART, 0); |
392 | 392 | ||
393 | serialize_require(DEBUGSPEW_PARAM_COMMA(U_) _L); | 393 | serialize_require(_L); |
394 | 394 | ||
395 | // call this after the base libraries are loaded and GC is restarted | 395 | // call this after the base libraries are loaded and GC is restarted |
396 | // will raise an error in from_ in case of problem | 396 | // will raise an error in from_ in case of problem |