diff options
Diffstat (limited to 'src/state.cpp')
-rw-r--r-- | src/state.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/state.cpp b/src/state.cpp index 55540c8..512009a 100644 --- a/src/state.cpp +++ b/src/state.cpp | |||
@@ -200,8 +200,8 @@ static void copy_one_time_settings( Universe* U, lua_State* L, lua_State* L2) | |||
200 | STACK_CHECK_START_REL(L, 0); | 200 | STACK_CHECK_START_REL(L, 0); |
201 | STACK_CHECK_START_REL(L2, 0); | 201 | STACK_CHECK_START_REL(L2, 0); |
202 | 202 | ||
203 | DEBUGSPEW_CODE( fprintf( stderr, INDENT_BEGIN "copy_one_time_settings()\n" INDENT_END)); | 203 | DEBUGSPEW_CODE(fprintf( stderr, INDENT_BEGIN "copy_one_time_settings()\n" INDENT_END)); |
204 | DEBUGSPEW_CODE( ++ U->debugspew_indent_depth); | 204 | DEBUGSPEW_CODE(U->debugspew_indent_depth.fetch_add(1, std::memory_order_relaxed)); |
205 | 205 | ||
206 | CONFIG_REGKEY.pushValue(L); // config | 206 | CONFIG_REGKEY.pushValue(L); // config |
207 | // copy settings from from source to destination registry | 207 | // copy settings from from source to destination registry |
@@ -213,7 +213,7 @@ static void copy_one_time_settings( Universe* U, lua_State* L, lua_State* L2) | |||
213 | CONFIG_REGKEY.setValue(L2, [](lua_State* L) { lua_insert(L, -2); }); // config | 213 | CONFIG_REGKEY.setValue(L2, [](lua_State* L) { lua_insert(L, -2); }); // config |
214 | STACK_CHECK( L2, 0); | 214 | STACK_CHECK( L2, 0); |
215 | STACK_CHECK( L, 0); | 215 | STACK_CHECK( L, 0); |
216 | DEBUGSPEW_CODE( -- U->debugspew_indent_depth); | 216 | DEBUGSPEW_CODE(U->debugspew_indent_depth.fetch_sub(1, std::memory_order_relaxed)); |
217 | } | 217 | } |
218 | 218 | ||
219 | void initialize_on_state_create( Universe* U, lua_State* L) | 219 | void initialize_on_state_create( Universe* U, lua_State* L) |
@@ -349,8 +349,8 @@ lua_State* luaG_newstate( Universe* U, lua_State* from_, char const* libs_) | |||
349 | return L; | 349 | return L; |
350 | } | 350 | } |
351 | 351 | ||
352 | DEBUGSPEW_CODE( fprintf( stderr, INDENT_BEGIN "luaG_newstate()\n" INDENT_END)); | 352 | DEBUGSPEW_CODE(fprintf( stderr, INDENT_BEGIN "luaG_newstate()\n" INDENT_END)); |
353 | DEBUGSPEW_CODE( ++ U->debugspew_indent_depth); | 353 | DEBUGSPEW_CODE(U->debugspew_indent_depth.fetch_add(1, std::memory_order_relaxed)); |
354 | 354 | ||
355 | // copy settings (for example because it may contain a Lua on_state_create function) | 355 | // copy settings (for example because it may contain a Lua on_state_create function) |
356 | copy_one_time_settings( U, from_, L); | 356 | copy_one_time_settings( U, from_, L); |
@@ -423,22 +423,22 @@ lua_State* luaG_newstate( Universe* U, lua_State* from_, char const* libs_) | |||
423 | 423 | ||
424 | #if 0 && USE_DEBUG_SPEW() | 424 | #if 0 && USE_DEBUG_SPEW() |
425 | // dump the lookup database contents | 425 | // dump the lookup database contents |
426 | lua_getfield( L, LUA_REGISTRYINDEX, LOOKUP_REGKEY); // {} | 426 | lua_getfield(L, LUA_REGISTRYINDEX, LOOKUP_REGKEY); // {} |
427 | lua_pushnil( L); // {} nil | 427 | lua_pushnil(L); // {} nil |
428 | while( lua_next( L, -2)) // {} k v | 428 | while (lua_next(L, -2)) // {} k v |
429 | { | 429 | { |
430 | lua_getglobal( L, "print"); // {} k v print | 430 | lua_getglobal(L, "print"); // {} k v print |
431 | lua_pushlstring( L, debugspew_indent, U->debugspew_indent_depth); // {} k v print " " | 431 | lua_pushlstring(L, debugspew_indent, U->debugspew_indent_depth.load(std::memory_order_relaxed)); // {} k v print " " |
432 | lua_pushvalue( L, -4); // {} k v print " " k | 432 | lua_pushvalue(L, -4); // {} k v print " " k |
433 | lua_pushvalue( L, -4); // {} k v print " " k v | 433 | lua_pushvalue(L, -4); // {} k v print " " k v |
434 | lua_call( L, 3, 0); // {} k v | 434 | lua_call(L, 3, 0); // {} k v |
435 | lua_pop( L, 1); // {} k | 435 | lua_pop(L, 1); // {} k |
436 | } | 436 | } |
437 | lua_pop( L, 1); // {} | 437 | lua_pop(L, 1); // {} |
438 | #endif // USE_DEBUG_SPEW() | 438 | #endif // USE_DEBUG_SPEW() |
439 | 439 | ||
440 | lua_pop( L, 1); | 440 | lua_pop(L, 1); |
441 | STACK_CHECK(L, 0); | 441 | STACK_CHECK(L, 0); |
442 | DEBUGSPEW_CODE(--U->debugspew_indent_depth); | 442 | DEBUGSPEW_CODE(U->debugspew_indent_depth.fetch_sub(1, std::memory_order_relaxed)); |
443 | return L; | 443 | return L; |
444 | } | 444 | } |