diff options
Diffstat (limited to 'src/state.cpp')
-rw-r--r-- | src/state.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/state.cpp b/src/state.cpp index fc7f5ef..2f64194 100644 --- a/src/state.cpp +++ b/src/state.cpp | |||
@@ -166,7 +166,7 @@ namespace state { | |||
166 | }; | 166 | }; |
167 | 167 | ||
168 | if (_L == nullptr) { | 168 | if (_L == nullptr) { |
169 | raise_luaL_error(from_, "luaG_newstate() failed while creating state; out of memory"); | 169 | raise_luaL_error(from_, "luaW_newstate() failed while creating state; out of memory"); |
170 | } | 170 | } |
171 | return _L; | 171 | return _L; |
172 | } | 172 | } |
@@ -202,11 +202,11 @@ namespace state { | |||
202 | 202 | ||
203 | // neither libs (not even 'base') nor special init func: we are done | 203 | // neither libs (not even 'base') nor special init func: we are done |
204 | if (!libs_.has_value() && std::holds_alternative<std::nullptr_t>(U_->onStateCreateFunc)) { | 204 | if (!libs_.has_value() && std::holds_alternative<std::nullptr_t>(U_->onStateCreateFunc)) { |
205 | DEBUGSPEW_CODE(DebugSpew(U_) << "luaG_newstate(nullptr)" << std::endl); | 205 | DEBUGSPEW_CODE(DebugSpew(U_) << "luaW_newstate(nullptr)" << std::endl); |
206 | return _L; | 206 | return _L; |
207 | } | 207 | } |
208 | 208 | ||
209 | DEBUGSPEW_CODE(DebugSpew(U_) << "luaG_newstate()" << std::endl); | 209 | DEBUGSPEW_CODE(DebugSpew(U_) << "luaW_newstate()" << std::endl); |
210 | DEBUGSPEW_CODE(DebugSpewIndentScope _scope{ U_ }); | 210 | DEBUGSPEW_CODE(DebugSpewIndentScope _scope{ U_ }); |
211 | 211 | ||
212 | // copy settings (for example because it may contain a Lua on_state_create function) | 212 | // copy settings (for example because it may contain a Lua on_state_create function) |
@@ -239,7 +239,7 @@ namespace state { | |||
239 | lua_pop(_L, 1); | 239 | lua_pop(_L, 1); |
240 | } else { | 240 | } else { |
241 | lua_pushcfunction(_L, luaopen_base); | 241 | lua_pushcfunction(_L, luaopen_base); |
242 | luaG_pushstring(_L, ""); | 242 | luaW_pushstring(_L, ""); |
243 | lua_call(_L, 1, 0); | 243 | lua_call(_L, 1, 0); |
244 | } | 244 | } |
245 | } | 245 | } |
@@ -274,7 +274,7 @@ namespace state { | |||
274 | 274 | ||
275 | STACK_CHECK(_L, 0); | 275 | STACK_CHECK(_L, 0); |
276 | // after all this, register everything we find in our name<->function database | 276 | // after all this, register everything we find in our name<->function database |
277 | luaG_pushglobaltable(_L); // L: _G | 277 | luaW_pushglobaltable(_L); // L: _G |
278 | tools::PopulateFuncLookupTable(_L, kIdxTop, {}); | 278 | tools::PopulateFuncLookupTable(_L, kIdxTop, {}); |
279 | lua_pop(_L, 1); // L: | 279 | lua_pop(_L, 1); // L: |
280 | STACK_CHECK(_L, 0); | 280 | STACK_CHECK(_L, 0); |
@@ -286,19 +286,19 @@ namespace state { | |||
286 | kLookupRegKey.pushValue(_L); // L: {} | 286 | kLookupRegKey.pushValue(_L); // L: {} |
287 | lua_pushnil(_L); // L: {} nil | 287 | lua_pushnil(_L); // L: {} nil |
288 | while (lua_next(_L, -2)) { // L: {} k v | 288 | while (lua_next(_L, -2)) { // L: {} k v |
289 | luaG_pushstring(_L, "["); // L: {} k v "[" | 289 | luaW_pushstring(_L, "["); // L: {} k v "[" |
290 | 290 | ||
291 | lua_getglobal(_L, "tostring"); // L: {} k v "[" tostring | 291 | lua_getglobal(_L, "tostring"); // L: {} k v "[" tostring |
292 | lua_pushvalue(_L, -4); // L: {} k v "[" tostring k | 292 | lua_pushvalue(_L, -4); // L: {} k v "[" tostring k |
293 | lua_call(_L, 1, 1); // L: {} k v "[" 'k' | 293 | lua_call(_L, 1, 1); // L: {} k v "[" 'k' |
294 | 294 | ||
295 | luaG_pushstring(_L, "] = "); // L: {} k v "[" 'k' "] = " | 295 | luaW_pushstring(_L, "] = "); // L: {} k v "[" 'k' "] = " |
296 | 296 | ||
297 | lua_getglobal(_L, "tostring"); // L: {} k v "[" 'k' "] = " tostring | 297 | lua_getglobal(_L, "tostring"); // L: {} k v "[" 'k' "] = " tostring |
298 | lua_pushvalue(_L, -5); // L: {} k v "[" 'k' "] = " tostring v | 298 | lua_pushvalue(_L, -5); // L: {} k v "[" 'k' "] = " tostring v |
299 | lua_call(_L, 1, 1); // L: {} k v "[" 'k' "] = " 'v' | 299 | lua_call(_L, 1, 1); // L: {} k v "[" 'k' "] = " 'v' |
300 | lua_concat(_L, 4); // L: {} k v "[k] = v" | 300 | lua_concat(_L, 4); // L: {} k v "[k] = v" |
301 | DEBUGSPEW_CODE(DebugSpew(U_) << luaG_tostring(_L, kIdxTop) << std::endl); | 301 | DEBUGSPEW_CODE(DebugSpew(U_) << luaW_tostring(_L, kIdxTop) << std::endl); |
302 | lua_pop(_L, 2); // L: {} k | 302 | lua_pop(_L, 2); // L: {} k |
303 | } // lua_next() // L: {} | 303 | } // lua_next() // L: {} |
304 | lua_pop(_L, 1); // L: | 304 | lua_pop(_L, 1); // L: |
@@ -317,7 +317,7 @@ namespace state { | |||
317 | lua_newtable(L_); // L_: out | 317 | lua_newtable(L_); // L_: out |
318 | for (luaL_Reg const& _entry : local::sLibs) { | 318 | for (luaL_Reg const& _entry : local::sLibs) { |
319 | lua_pushboolean(L_, 1); // L_: out true | 319 | lua_pushboolean(L_, 1); // L_: out true |
320 | luaG_setfield(L_, StackIndex{ -2 }, std::string_view{ _entry.name }); // out[name] = true // L_: out | 320 | luaW_setfield(L_, StackIndex{ -2 }, std::string_view{ _entry.name }); // out[name] = true // L_: out |
321 | } | 321 | } |
322 | STACK_CHECK(L_, 1); | 322 | STACK_CHECK(L_, 1); |
323 | return 1; | 323 | return 1; |