diff options
| author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-06-14 16:01:26 +0200 |
|---|---|---|
| committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-06-14 16:01:26 +0200 |
| commit | 4d364d3e77667b70bf3261da004f4990ef0c3ada (patch) | |
| tree | 5a106ca427ba8704635b3324a352475dd8706ab8 /src | |
| parent | a925a9ee21c10184a08625e83d2b55850d6cb32f (diff) | |
| download | lanes-4d364d3e77667b70bf3261da004f4990ef0c3ada.tar.gz lanes-4d364d3e77667b70bf3261da004f4990ef0c3ada.tar.bz2 lanes-4d364d3e77667b70bf3261da004f4990ef0c3ada.zip | |
lua_pushliteral -> luaG_pushstring
Diffstat (limited to 'src')
| -rw-r--r-- | src/compat.h | 2 | ||||
| -rw-r--r-- | src/deep.cpp | 2 | ||||
| -rw-r--r-- | src/intercopycontext.cpp | 12 | ||||
| -rw-r--r-- | src/keeper.cpp | 2 | ||||
| -rw-r--r-- | src/lane.cpp | 24 | ||||
| -rw-r--r-- | src/lane.h | 2 | ||||
| -rw-r--r-- | src/lanes.cpp | 12 | ||||
| -rw-r--r-- | src/linda.cpp | 10 | ||||
| -rw-r--r-- | src/lindafactory.cpp | 2 | ||||
| -rw-r--r-- | src/nameof.cpp | 10 | ||||
| -rw-r--r-- | src/state.cpp | 6 | ||||
| -rw-r--r-- | src/tools.cpp | 6 | ||||
| -rw-r--r-- | src/tracker.cpp | 2 | ||||
| -rw-r--r-- | src/uniquekey.h | 8 | ||||
| -rw-r--r-- | src/universe.cpp | 2 |
15 files changed, 51 insertions, 51 deletions
diff --git a/src/compat.h b/src/compat.h index 714556e..0a02174 100644 --- a/src/compat.h +++ b/src/compat.h | |||
| @@ -349,7 +349,7 @@ template <typename T> | |||
| 349 | } | 349 | } |
| 350 | 350 | ||
| 351 | template<typename ...EXTRA> | 351 | template<typename ...EXTRA> |
| 352 | [[nodiscard]] inline std::string_view luaG_pushstring(lua_State* const L_, std::string_view const& str_, EXTRA&&... extra_) | 352 | inline std::string_view luaG_pushstring(lua_State* const L_, std::string_view const& str_, EXTRA&&... extra_) |
| 353 | { | 353 | { |
| 354 | if constexpr (sizeof...(EXTRA) == 0) { | 354 | if constexpr (sizeof...(EXTRA) == 0) { |
| 355 | if constexpr (LUA_VERSION_NUM == 501) { | 355 | if constexpr (LUA_VERSION_NUM == 501) { |
diff --git a/src/deep.cpp b/src/deep.cpp index 249c497..8754178 100644 --- a/src/deep.cpp +++ b/src/deep.cpp | |||
| @@ -237,7 +237,7 @@ void DeepFactory::PushDeepProxy(DestState const L_, DeepPrelude* const prelude_, | |||
| 237 | raise_luaL_error(errL_, "lanes receiving deep userdata should register the 'package' library"); | 237 | raise_luaL_error(errL_, "lanes receiving deep userdata should register the 'package' library"); |
| 238 | } | 238 | } |
| 239 | 239 | ||
| 240 | std::ignore = luaG_pushstring(L_, _modname); // L_: DPC proxy metatable require() "module" | 240 | luaG_pushstring(L_, _modname); // L_: DPC proxy metatable require() "module" |
| 241 | if (luaG_getfield(L_, LUA_REGISTRYINDEX, LUA_LOADED_TABLE) != LuaType::TABLE) { // L_: DPC proxy metatable require() "module" _R._LOADED | 241 | if (luaG_getfield(L_, LUA_REGISTRYINDEX, LUA_LOADED_TABLE) != LuaType::TABLE) { // L_: DPC proxy metatable require() "module" _R._LOADED |
| 242 | // no L.registry._LOADED; can this ever happen? | 242 | // no L.registry._LOADED; can this ever happen? |
| 243 | lua_pop(L_, 6); // L_: | 243 | lua_pop(L_, 6); // L_: |
diff --git a/src/intercopycontext.cpp b/src/intercopycontext.cpp index 9fa5911..285ca9b 100644 --- a/src/intercopycontext.cpp +++ b/src/intercopycontext.cpp | |||
| @@ -310,7 +310,7 @@ void InterCopyContext::lookupNativeFunction() const | |||
| 310 | 310 | ||
| 311 | case LookupMode::ToKeeper: | 311 | case LookupMode::ToKeeper: |
| 312 | // push a sentinel closure that holds the lookup name as upvalue | 312 | // push a sentinel closure that holds the lookup name as upvalue |
| 313 | std::ignore = luaG_pushstring(L2, _fqn); // L1: ... f ... L2: "f.q.n" | 313 | luaG_pushstring(L2, _fqn); // L1: ... f ... L2: "f.q.n" |
| 314 | lua_pushcclosure(L2, func_lookup_sentinel, 1); // L1: ... f ... L2: f | 314 | lua_pushcclosure(L2, func_lookup_sentinel, 1); // L1: ... f ... L2: f |
| 315 | break; | 315 | break; |
| 316 | 316 | ||
| @@ -319,7 +319,7 @@ void InterCopyContext::lookupNativeFunction() const | |||
| 319 | kLookupRegKey.pushValue(L2); // L1: ... f ... L2: {} | 319 | kLookupRegKey.pushValue(L2); // L1: ... f ... L2: {} |
| 320 | STACK_CHECK(L2, 1); | 320 | STACK_CHECK(L2, 1); |
| 321 | LUA_ASSERT(L1, lua_istable(L2, -1)); | 321 | LUA_ASSERT(L1, lua_istable(L2, -1)); |
| 322 | std::ignore = luaG_pushstring(L2, _fqn); // L1: ... f ... L2: {} "f.q.n" | 322 | luaG_pushstring(L2, _fqn); // L1: ... f ... L2: {} "f.q.n" |
| 323 | lua_rawget(L2, -2); // L1: ... f ... L2: {} f | 323 | lua_rawget(L2, -2); // L1: ... f ... L2: {} f |
| 324 | // nil means we don't know how to transfer stuff: user should do something | 324 | // nil means we don't know how to transfer stuff: user should do something |
| 325 | // anything other than function or table should not happen! | 325 | // anything other than function or table should not happen! |
| @@ -430,7 +430,7 @@ void InterCopyContext::copyCachedFunction() const | |||
| 430 | 430 | ||
| 431 | case LookupMode::ToKeeper: | 431 | case LookupMode::ToKeeper: |
| 432 | // push a sentinel closure that holds the lookup name as upvalue | 432 | // push a sentinel closure that holds the lookup name as upvalue |
| 433 | std::ignore = luaG_pushstring(L2, _fqn); // L1: ... t ... L2: "f.q.n" | 433 | luaG_pushstring(L2, _fqn); // L1: ... t ... L2: "f.q.n" |
| 434 | lua_pushcclosure(L2, table_lookup_sentinel, 1); // L1: ... t ... L2: f | 434 | lua_pushcclosure(L2, table_lookup_sentinel, 1); // L1: ... t ... L2: f |
| 435 | break; | 435 | break; |
| 436 | 436 | ||
| @@ -439,7 +439,7 @@ void InterCopyContext::copyCachedFunction() const | |||
| 439 | kLookupRegKey.pushValue(L2); // L1: ... t ... L2: {} | 439 | kLookupRegKey.pushValue(L2); // L1: ... t ... L2: {} |
| 440 | STACK_CHECK(L2, 1); | 440 | STACK_CHECK(L2, 1); |
| 441 | LUA_ASSERT(L1, lua_istable(L2, -1)); | 441 | LUA_ASSERT(L1, lua_istable(L2, -1)); |
| 442 | std::ignore = luaG_pushstring(L2, _fqn); // L2: {} "f.q.n" | 442 | luaG_pushstring(L2, _fqn); // L2: {} "f.q.n" |
| 443 | lua_rawget(L2, -2); // L2: {} t | 443 | lua_rawget(L2, -2); // L2: {} t |
| 444 | // we accept destination lookup failures in the case of transfering the Lanes body function (this will result in the source table being cloned instead) | 444 | // we accept destination lookup failures in the case of transfering the Lanes body function (this will result in the source table being cloned instead) |
| 445 | // but not when we extract something out of a keeper, as there is nothing to clone! | 445 | // but not when we extract something out of a keeper, as there is nothing to clone! |
| @@ -582,7 +582,7 @@ LuaType InterCopyContext::processConversion() const | |||
| 582 | 582 | ||
| 583 | case LuaType::FUNCTION: | 583 | case LuaType::FUNCTION: |
| 584 | lua_pushvalue(L1, L1_i); // L1: ... mt kConvertField val | 584 | lua_pushvalue(L1, L1_i); // L1: ... mt kConvertField val |
| 585 | std::ignore = luaG_pushstring(L1, mode == LookupMode::ToKeeper ? "keeper" : "regular"); // L1: ... mt kConvertField val string | 585 | luaG_pushstring(L1, mode == LookupMode::ToKeeper ? "keeper" : "regular"); // L1: ... mt kConvertField val string |
| 586 | lua_call(L1, 2, 1); // val:kConvertField(str) -> result // L1: ... mt kConvertField converted | 586 | lua_call(L1, 2, 1); // val:kConvertField(str) -> result // L1: ... mt kConvertField converted |
| 587 | lua_replace(L1, L1_i); // L1: ... mt | 587 | lua_replace(L1, L1_i); // L1: ... mt |
| 588 | lua_pop(L1, 1); // L1: ... mt | 588 | lua_pop(L1, 1); // L1: ... mt |
| @@ -1003,7 +1003,7 @@ LuaType InterCopyContext::processConversion() const | |||
| 1003 | { | 1003 | { |
| 1004 | std::string_view const _s{ luaG_tostring(L1, L1_i) }; | 1004 | std::string_view const _s{ luaG_tostring(L1, L1_i) }; |
| 1005 | DEBUGSPEW_CODE(DebugSpew(nullptr) << "'" << _s << "'" << std::endl); | 1005 | DEBUGSPEW_CODE(DebugSpew(nullptr) << "'" << _s << "'" << std::endl); |
| 1006 | std::ignore = luaG_pushstring(L2, _s); | 1006 | luaG_pushstring(L2, _s); |
| 1007 | return true; | 1007 | return true; |
| 1008 | } | 1008 | } |
| 1009 | 1009 | ||
diff --git a/src/keeper.cpp b/src/keeper.cpp index 6aeea45..7038f2c 100644 --- a/src/keeper.cpp +++ b/src/keeper.cpp | |||
| @@ -838,7 +838,7 @@ void Keepers::initialize(Universe& U_, lua_State* L_, int const nbKeepers_, int | |||
| 838 | keeper_.K = _K; | 838 | keeper_.K = _K; |
| 839 | 839 | ||
| 840 | // Give a name to the state | 840 | // Give a name to the state |
| 841 | std::ignore = luaG_pushstring(_K, "Keeper #%d", i_ + 1); // L_: settings _K: "Keeper #n" | 841 | luaG_pushstring(_K, "Keeper #%d", i_ + 1); // L_: settings _K: "Keeper #n" |
| 842 | if constexpr (HAVE_DECODA_SUPPORT()) { | 842 | if constexpr (HAVE_DECODA_SUPPORT()) { |
| 843 | lua_pushvalue(_K, -1); // _K: "Keeper #n" Keeper #n" | 843 | lua_pushvalue(_K, -1); // _K: "Keeper #n" Keeper #n" |
| 844 | lua_setglobal(_K, "decoda_name"); // L_: settings _K: "Keeper #n" | 844 | lua_setglobal(_K, "decoda_name"); // L_: settings _K: "Keeper #n" |
diff --git a/src/lane.cpp b/src/lane.cpp index 8f31973..17c4126 100644 --- a/src/lane.cpp +++ b/src/lane.cpp | |||
| @@ -48,7 +48,7 @@ static LUAG_FUNC(get_debug_threadname) | |||
| 48 | { | 48 | { |
| 49 | Lane* const _lane{ ToLane(L_, 1) }; | 49 | Lane* const _lane{ ToLane(L_, 1) }; |
| 50 | luaL_argcheck(L_, lua_gettop(L_) == 1, 2, "too many arguments"); | 50 | luaL_argcheck(L_, lua_gettop(L_) == 1, 2, "too many arguments"); |
| 51 | std::ignore = luaG_pushstring(L_, _lane->debugName); | 51 | luaG_pushstring(L_, _lane->debugName); |
| 52 | return 1; | 52 | return 1; |
| 53 | } | 53 | } |
| 54 | 54 | ||
| @@ -123,7 +123,7 @@ static LUAG_FUNC(thread_join) | |||
| 123 | lua_State* const _L2{ _lane->L }; | 123 | lua_State* const _L2{ _lane->L }; |
| 124 | if (!_done || !_L2) { | 124 | if (!_done || !_L2) { |
| 125 | lua_pushnil(L_); // L_: lane nil | 125 | lua_pushnil(L_); // L_: lane nil |
| 126 | lua_pushliteral(L_, "timeout"); // L_: lane nil "timeout" | 126 | luaG_pushstring(L_, "timeout"); // L_: lane nil "timeout" |
| 127 | return 2; | 127 | return 2; |
| 128 | } | 128 | } |
| 129 | 129 | ||
| @@ -218,7 +218,7 @@ static int thread_index_number(lua_State* L_) | |||
| 218 | lua_pushboolean(L_, 1); // L_: lane n {uv} 0 true | 218 | lua_pushboolean(L_, 1); // L_: lane n {uv} 0 true |
| 219 | lua_rawset(L_, kUsr); // L_: lane n {uv} | 219 | lua_rawset(L_, kUsr); // L_: lane n {uv} |
| 220 | // tell join() that we are called from __index, to avoid raising an error if the first returned value is not nil | 220 | // tell join() that we are called from __index, to avoid raising an error if the first returned value is not nil |
| 221 | std::ignore = luaG_pushstring(L_, "[]"); // L_: lane n {uv} "[]" | 221 | luaG_pushstring(L_, "[]"); // L_: lane n {uv} "[]" |
| 222 | // wait until thread has completed, transfer everything from the lane's stack to our side | 222 | // wait until thread has completed, transfer everything from the lane's stack to our side |
| 223 | lua_pushcclosure(L_, LG_thread_join, 1); // L_: lane n {uv} join | 223 | lua_pushcclosure(L_, LG_thread_join, 1); // L_: lane n {uv} join |
| 224 | lua_pushvalue(L_, kSelf); // L_: lane n {uv} join lane | 224 | lua_pushvalue(L_, kSelf); // L_: lane n {uv} join lane |
| @@ -227,7 +227,7 @@ static int thread_index_number(lua_State* L_) | |||
| 227 | default: | 227 | default: |
| 228 | // this is an internal error, we probably never get here | 228 | // this is an internal error, we probably never get here |
| 229 | lua_settop(L_, 0); // L_: | 229 | lua_settop(L_, 0); // L_: |
| 230 | lua_pushliteral(L_, "Unexpected status: "); // L_: "Unexpected status: " | 230 | luaG_pushstring(L_, "Unexpected status: "); // L_: "Unexpected status: " |
| 231 | std::ignore = _lane->pushThreadStatus(L_); // L_: "Unexpected status: " "<status>" | 231 | std::ignore = _lane->pushThreadStatus(L_); // L_: "Unexpected status: " "<status>" |
| 232 | lua_concat(L_, 2); // L_: "Unexpected status: <status>" | 232 | lua_concat(L_, 2); // L_: "Unexpected status: <status>" |
| 233 | raise_lua_error(L_); | 233 | raise_lua_error(L_); |
| @@ -353,7 +353,7 @@ static LUAG_FUNC(thread_index) | |||
| 353 | default: // unknown key | 353 | default: // unknown key |
| 354 | lua_getmetatable(L_, kSelf); // L_: mt | 354 | lua_getmetatable(L_, kSelf); // L_: mt |
| 355 | std::ignore = luaG_getfield(L_, -1, "cached_error"); // L_: mt error | 355 | std::ignore = luaG_getfield(L_, -1, "cached_error"); // L_: mt error |
| 356 | lua_pushliteral(L_, "Unknown key: "); // L_: mt error "Unknown key: " | 356 | luaG_pushstring(L_, "Unknown key: "); // L_: mt error "Unknown key: " |
| 357 | lua_pushvalue(L_, kKey); // L_: mt error "Unknown key: " k | 357 | lua_pushvalue(L_, kKey); // L_: mt error "Unknown key: " k |
| 358 | lua_concat(L_, 2); // L_: mt error "Unknown key: <k>" | 358 | lua_concat(L_, 2); // L_: mt error "Unknown key: <k>" |
| 359 | lua_call(L_, 1, 0); // error( "Unknown key: " .. key) -> doesn't return // L_: mt | 359 | lua_call(L_, 1, 0); // error( "Unknown key: " .. key) -> doesn't return // L_: mt |
| @@ -474,9 +474,9 @@ static constexpr RegistryUniqueKey kStackTraceRegKey{ 0x3F327747CACAA904ull }; | |||
| 474 | lua_pushstring(L_, _ar.what); // L_: some_error {} {} what | 474 | lua_pushstring(L_, _ar.what); // L_: some_error {} {} what |
| 475 | lua_setfield(L_, -2, "what"); // L_: some_error {} {} | 475 | lua_setfield(L_, -2, "what"); // L_: some_error {} {} |
| 476 | } else if (_ar.currentline > 0) { | 476 | } else if (_ar.currentline > 0) { |
| 477 | std::ignore = luaG_pushstring(L_, "%s:%d", _ar.short_src, _ar.currentline); // L_: some_error {} "blah:blah" | 477 | luaG_pushstring(L_, "%s:%d", _ar.short_src, _ar.currentline); // L_: some_error {} "blah:blah" |
| 478 | } else { | 478 | } else { |
| 479 | std::ignore = luaG_pushstring(L_, "%s:?", _ar.short_src); // L_: some_error {} "blah" | 479 | luaG_pushstring(L_, "%s:?", _ar.short_src); // L_: some_error {} "blah" |
| 480 | } | 480 | } |
| 481 | lua_rawseti(L_, -2, static_cast<lua_Integer>(_n)); // L_: some_error {} | 481 | lua_rawseti(L_, -2, static_cast<lua_Integer>(_n)); // L_: some_error {} |
| 482 | } | 482 | } |
| @@ -745,7 +745,7 @@ static LUAG_FUNC(lane_close) | |||
| 745 | lua_settop(L_, 1); // L_: lane | 745 | lua_settop(L_, 1); // L_: lane |
| 746 | 746 | ||
| 747 | // no error if the lane body doesn't return a non-nil first value | 747 | // no error if the lane body doesn't return a non-nil first value |
| 748 | std::ignore = luaG_pushstring(L_, "close"); // L_: lane "close" | 748 | luaG_pushstring(L_, "close"); // L_: lane "close" |
| 749 | lua_pushcclosure(L_, LG_thread_join, 1); // L_: lane join() | 749 | lua_pushcclosure(L_, LG_thread_join, 1); // L_: lane join() |
| 750 | lua_insert(L_, 1); // L_: join() lane | 750 | lua_insert(L_, 1); // L_: join() lane |
| 751 | lua_call(L_, 1, LUA_MULTRET); // L_: join() results | 751 | lua_call(L_, 1, LUA_MULTRET); // L_: join() results |
| @@ -777,7 +777,7 @@ static LUAG_FUNC(lane_gc) | |||
| 777 | lua_rawget(L_, -2); // L_: ud uservalue gc_cb|nil | 777 | lua_rawget(L_, -2); // L_: ud uservalue gc_cb|nil |
| 778 | if (!lua_isnil(L_, -1)) { | 778 | if (!lua_isnil(L_, -1)) { |
| 779 | lua_remove(L_, -2); // L_: ud gc_cb|nil | 779 | lua_remove(L_, -2); // L_: ud gc_cb|nil |
| 780 | std::ignore = luaG_pushstring(L_, _lane->debugName); // L_: ud gc_cb name | 780 | luaG_pushstring(L_, _lane->debugName); // L_: ud gc_cb name |
| 781 | _have_gc_cb = true; | 781 | _have_gc_cb = true; |
| 782 | } else { | 782 | } else { |
| 783 | lua_pop(L_, 2); // L_: ud | 783 | lua_pop(L_, 2); // L_: ud |
| @@ -789,7 +789,7 @@ static LUAG_FUNC(lane_gc) | |||
| 789 | selfdestruct_add(_lane); | 789 | selfdestruct_add(_lane); |
| 790 | assert(_lane->selfdestruct_next); | 790 | assert(_lane->selfdestruct_next); |
| 791 | if (_have_gc_cb) { | 791 | if (_have_gc_cb) { |
| 792 | lua_pushliteral(L_, "selfdestruct"); // L_: ud gc_cb name status | 792 | luaG_pushstring(L_, "selfdestruct"); // L_: ud gc_cb name status |
| 793 | lua_call(L_, 2, 0); // L_: ud | 793 | lua_call(L_, 2, 0); // L_: ud |
| 794 | } | 794 | } |
| 795 | return 0; | 795 | return 0; |
| @@ -805,7 +805,7 @@ static LUAG_FUNC(lane_gc) | |||
| 805 | 805 | ||
| 806 | // do this after lane cleanup in case the callback triggers an error | 806 | // do this after lane cleanup in case the callback triggers an error |
| 807 | if (_have_gc_cb) { | 807 | if (_have_gc_cb) { |
| 808 | lua_pushliteral(L_, "closed"); // L_: ud gc_cb name status | 808 | luaG_pushstring(L_, "closed"); // L_: ud gc_cb name status |
| 809 | lua_call(L_, 2, 0); // L_: ud | 809 | lua_call(L_, 2, 0); // L_: ud |
| 810 | } | 810 | } |
| 811 | return 0; | 811 | return 0; |
| @@ -979,7 +979,7 @@ void Lane::PushMetatable(lua_State* L_) | |||
| 979 | lua_getglobal(L_, "tostring"); // L_: mt kCachedTostring tostring() | 979 | lua_getglobal(L_, "tostring"); // L_: mt kCachedTostring tostring() |
| 980 | lua_rawset(L_, -3); // L_: mt | 980 | lua_rawset(L_, -3); // L_: mt |
| 981 | // hide the actual metatable from getmetatable() | 981 | // hide the actual metatable from getmetatable() |
| 982 | lua_pushliteral(L_, kLaneMetatableName); // L_: mt "Lane" | 982 | luaG_pushstring(L_, kLaneMetatableName); // L_: mt "Lane" |
| 983 | lua_setfield(L_, -2, "__metatable"); // L_: mt | 983 | lua_setfield(L_, -2, "__metatable"); // L_: mt |
| 984 | } | 984 | } |
| 985 | STACK_CHECK(L_, 1); | 985 | STACK_CHECK(L_, 1); |
| @@ -34,7 +34,7 @@ static constexpr RegistryUniqueKey kLaneNameRegKey{ 0xA194E2645C57F6DDull }; | |||
| 34 | // The chain is ended by '(Lane*)(-1)', not nullptr: 'selfdestructFirst -> ... -> ... -> (-1)' | 34 | // The chain is ended by '(Lane*)(-1)', not nullptr: 'selfdestructFirst -> ... -> ... -> (-1)' |
| 35 | #define SELFDESTRUCT_END ((Lane*) (-1)) | 35 | #define SELFDESTRUCT_END ((Lane*) (-1)) |
| 36 | 36 | ||
| 37 | // must be a #define instead of a constexpr to work with lua_pushliteral (until I templatize it) | 37 | // must be a #define instead of a constexpr to benefit from compile-time string concatenation |
| 38 | #define kLaneMetatableName "Lane" | 38 | #define kLaneMetatableName "Lane" |
| 39 | #define kLanesLibName "lanes" | 39 | #define kLanesLibName "lanes" |
| 40 | #define kLanesCoreLibName kLanesLibName ".core" | 40 | #define kLanesCoreLibName kLanesLibName ".core" |
diff --git a/src/lanes.cpp b/src/lanes.cpp index 7196b72..f1aa873 100644 --- a/src/lanes.cpp +++ b/src/lanes.cpp | |||
| @@ -179,7 +179,7 @@ LUAG_FUNC(sleep) | |||
| 179 | else { | 179 | else { |
| 180 | lua_pushnumber(L_, lua_tonumber(L_, 1)); // L_: duration? receive() timerLinda duration | 180 | lua_pushnumber(L_, lua_tonumber(L_, 1)); // L_: duration? receive() timerLinda duration |
| 181 | } | 181 | } |
| 182 | std::ignore = luaG_pushstring(L_, "ac100de1-a696-4619-b2f0-a26de9d58ab8"); // L_: duration? receive() timerLinda duration key | 182 | luaG_pushstring(L_, "ac100de1-a696-4619-b2f0-a26de9d58ab8"); // L_: duration? receive() timerLinda duration key |
| 183 | STACK_CHECK(L_, 3); // 3 arguments ready | 183 | STACK_CHECK(L_, 3); // 3 arguments ready |
| 184 | lua_call(L_, 3, LUA_MULTRET); // timerLinda:receive(duration,key) // L_: duration? result... | 184 | lua_call(L_, 3, LUA_MULTRET); // timerLinda:receive(duration,key) // L_: duration? result... |
| 185 | return lua_gettop(L_) - 1; | 185 | return lua_gettop(L_) - 1; |
| @@ -352,12 +352,12 @@ LUAG_FUNC(lane_new) | |||
| 352 | if (!_debugName.empty()) | 352 | if (!_debugName.empty()) |
| 353 | { | 353 | { |
| 354 | if (_debugName != "auto") { | 354 | if (_debugName != "auto") { |
| 355 | std::ignore = luaG_pushstring(_L2, _debugName); // L: ... lane L2: "<name>" | 355 | luaG_pushstring(_L2, _debugName); // L: ... lane L2: "<name>" |
| 356 | } else { | 356 | } else { |
| 357 | lua_Debug _ar; | 357 | lua_Debug _ar; |
| 358 | lua_pushvalue(L, 1); // L: ... lane func | 358 | lua_pushvalue(L, 1); // L: ... lane func |
| 359 | lua_getinfo(L, ">S", &_ar); // L: ... lane | 359 | lua_getinfo(L, ">S", &_ar); // L: ... lane |
| 360 | std::ignore = luaG_pushstring(_L2, "%s:%d", _ar.short_src, _ar.linedefined); // L: ... lane L2: "<name>" | 360 | luaG_pushstring(_L2, "%s:%d", _ar.short_src, _ar.linedefined); // L: ... lane L2: "<name>" |
| 361 | } | 361 | } |
| 362 | lane->changeDebugName(-1); | 362 | lane->changeDebugName(-1); |
| 363 | lua_pop(_L2, 1); // L: ... lane L2: | 363 | lua_pop(_L2, 1); // L: ... lane L2: |
| @@ -440,7 +440,7 @@ LUAG_FUNC(lane_new) | |||
| 440 | lua_pop(_L2, 1); // L_: [fixed] args... n "modname" L2: | 440 | lua_pop(_L2, 1); // L_: [fixed] args... n "modname" L2: |
| 441 | raise_luaL_error(L_, "cannot pre-require modules without loading 'package' library first"); | 441 | raise_luaL_error(L_, "cannot pre-require modules without loading 'package' library first"); |
| 442 | } else { | 442 | } else { |
| 443 | std::ignore = luaG_pushstring(_L2, _name); // L_: [fixed] args... n "modname" L2: require() name | 443 | luaG_pushstring(_L2, _name); // L_: [fixed] args... n "modname" L2: require() name |
| 444 | LuaError const _rc{ lua_pcall(_L2, 1, 1, 0) }; // L_: [fixed] args... n "modname" L2: ret/errcode | 444 | LuaError const _rc{ lua_pcall(_L2, 1, 1, 0) }; // L_: [fixed] args... n "modname" L2: ret/errcode |
| 445 | if (_rc != LuaError::OK) { | 445 | if (_rc != LuaError::OK) { |
| 446 | // propagate error to main state if any | 446 | // propagate error to main state if any |
| @@ -674,7 +674,7 @@ LUAG_FUNC(configure) | |||
| 674 | 674 | ||
| 675 | if (_U == nullptr) { | 675 | if (_U == nullptr) { |
| 676 | // store a hidden reference in the registry to make sure the string is kept around even if a lane decides to manually change the "decoda_name" global... | 676 | // store a hidden reference in the registry to make sure the string is kept around even if a lane decides to manually change the "decoda_name" global... |
| 677 | kLaneNameRegKey.setValue(L_, [](lua_State* L_) { std::ignore = luaG_pushstring(L_, "main"); }); | 677 | kLaneNameRegKey.setValue(L_, [](lua_State* L_) { luaG_pushstring(L_, "main"); }); |
| 678 | 678 | ||
| 679 | // create the universe | 679 | // create the universe |
| 680 | _U = Universe::Create(L_); // L_: settings universe | 680 | _U = Universe::Create(L_); // L_: settings universe |
| @@ -714,7 +714,7 @@ LUAG_FUNC(configure) | |||
| 714 | lua_pushcclosure(L_, LG_require, 1); // L_: settings M lanes.require | 714 | lua_pushcclosure(L_, LG_require, 1); // L_: settings M lanes.require |
| 715 | lua_setfield(L_, -2, "require"); // L_: settings M | 715 | lua_setfield(L_, -2, "require"); // L_: settings M |
| 716 | 716 | ||
| 717 | std::ignore = luaG_pushstring( | 717 | luaG_pushstring( |
| 718 | L_, | 718 | L_, |
| 719 | "%d.%d.%d", | 719 | "%d.%d.%d", |
| 720 | LANES_VERSION_MAJOR, | 720 | LANES_VERSION_MAJOR, |
diff --git a/src/linda.cpp b/src/linda.cpp index 3c04bae..1933b06 100644 --- a/src/linda.cpp +++ b/src/linda.cpp | |||
| @@ -81,13 +81,13 @@ template <bool OPT> | |||
| 81 | { | 81 | { |
| 82 | Linda* const _linda{ ToLinda<OPT>(L_, idx_) }; | 82 | Linda* const _linda{ ToLinda<OPT>(L_, idx_) }; |
| 83 | if (_linda != nullptr) { | 83 | if (_linda != nullptr) { |
| 84 | std::ignore = luaG_pushstring(L_, "Linda: "); | 84 | luaG_pushstring(L_, "Linda: "); |
| 85 | std::string_view const _lindaName{ _linda->getName() }; | 85 | std::string_view const _lindaName{ _linda->getName() }; |
| 86 | if (!_lindaName.empty()) { | 86 | if (!_lindaName.empty()) { |
| 87 | std::ignore = luaG_pushstring(L_, _lindaName); | 87 | luaG_pushstring(L_, _lindaName); |
| 88 | } else { | 88 | } else { |
| 89 | // obfuscate the pointer so that we can't read the value with our eyes out of a script | 89 | // obfuscate the pointer so that we can't read the value with our eyes out of a script |
| 90 | std::ignore = luaG_pushstring(L_, "%p", _linda->obfuscated()); | 90 | luaG_pushstring(L_, "%p", _linda->obfuscated()); |
| 91 | } | 91 | } |
| 92 | lua_concat(L_, 2); | 92 | lua_concat(L_, 2); |
| 93 | return 1; | 93 | return 1; |
| @@ -599,7 +599,7 @@ LUAG_FUNC(linda_receive) | |||
| 599 | if (_nbPushed == 0) { | 599 | if (_nbPushed == 0) { |
| 600 | // not enough data in the linda slot to fulfill the request, return nil, "timeout" | 600 | // not enough data in the linda slot to fulfill the request, return nil, "timeout" |
| 601 | lua_pushnil(L_); | 601 | lua_pushnil(L_); |
| 602 | std::ignore = luaG_pushstring(L_, "timeout"); | 602 | luaG_pushstring(L_, "timeout"); |
| 603 | return 2; | 603 | return 2; |
| 604 | } | 604 | } |
| 605 | return _nbPushed; | 605 | return _nbPushed; |
| @@ -752,7 +752,7 @@ LUAG_FUNC(linda_send) | |||
| 752 | } else { | 752 | } else { |
| 753 | // not enough room in the Linda slot to fulfill the request, return nil, "timeout" | 753 | // not enough room in the Linda slot to fulfill the request, return nil, "timeout" |
| 754 | lua_pushnil(L_); | 754 | lua_pushnil(L_); |
| 755 | std::ignore = luaG_pushstring(L_, "timeout"); | 755 | luaG_pushstring(L_, "timeout"); |
| 756 | return 2; | 756 | return 2; |
| 757 | } | 757 | } |
| 758 | } | 758 | } |
diff --git a/src/lindafactory.cpp b/src/lindafactory.cpp index 863f16e..9ae2611 100644 --- a/src/lindafactory.cpp +++ b/src/lindafactory.cpp | |||
| @@ -49,7 +49,7 @@ void LindaFactory::createMetatable(lua_State* L_) const | |||
| 49 | lua_setfield(L_, -2, "__index"); | 49 | lua_setfield(L_, -2, "__index"); |
| 50 | 50 | ||
| 51 | // protect metatable from external access | 51 | // protect metatable from external access |
| 52 | lua_pushliteral(L_, kLindaMetatableName); | 52 | luaG_pushstring(L_, kLindaMetatableName); |
| 53 | lua_setfield(L_, -2, "__metatable"); | 53 | lua_setfield(L_, -2, "__metatable"); |
| 54 | 54 | ||
| 55 | // the linda functions | 55 | // the linda functions |
diff --git a/src/nameof.cpp b/src/nameof.cpp index 543c3d4..a33c2e5 100644 --- a/src/nameof.cpp +++ b/src/nameof.cpp | |||
| @@ -91,7 +91,7 @@ THE SOFTWARE. | |||
| 91 | if (lua_getmetatable(L_, -1)) { // L_: o "r" {c} {fqn} ... {?} k {} {mt} | 91 | if (lua_getmetatable(L_, -1)) { // L_: o "r" {c} {fqn} ... {?} k {} {mt} |
| 92 | if (lua_istable(L_, -1)) { | 92 | if (lua_istable(L_, -1)) { |
| 93 | ++depth_; | 93 | ++depth_; |
| 94 | lua_pushliteral(L_, "__metatable"); // L_: o "r" {c} {fqn} ... {?} k {} {mt} "__metatable" | 94 | luaG_pushstring(L_, "__metatable"); // L_: o "r" {c} {fqn} ... {?} k {} {mt} "__metatable" |
| 95 | lua_rawseti(L_, kFQN, depth_); // L_: o "r" {c} {fqn} ... {?} k {} {mt} | 95 | lua_rawseti(L_, kFQN, depth_); // L_: o "r" {c} {fqn} ... {?} k {} {mt} |
| 96 | shortest_ = DiscoverObjectNameRecur(L_, shortest_, depth_); | 96 | shortest_ = DiscoverObjectNameRecur(L_, shortest_, depth_); |
| 97 | lua_pushnil(L_); // L_: o "r" {c} {fqn} ... {?} k {} {mt} nil | 97 | lua_pushnil(L_); // L_: o "r" {c} {fqn} ... {?} k {} {mt} nil |
| @@ -113,7 +113,7 @@ THE SOFTWARE. | |||
| 113 | if (lua_getmetatable(L_, -1)) { // L_: o "r" {c} {fqn} ... {?} k U {mt} | 113 | if (lua_getmetatable(L_, -1)) { // L_: o "r" {c} {fqn} ... {?} k U {mt} |
| 114 | if (lua_istable(L_, -1)) { | 114 | if (lua_istable(L_, -1)) { |
| 115 | ++depth_; | 115 | ++depth_; |
| 116 | lua_pushliteral(L_, "__metatable"); // L_: o "r" {c} {fqn} ... {?} k U {mt} "__metatable" | 116 | luaG_pushstring(L_, "__metatable"); // L_: o "r" {c} {fqn} ... {?} k U {mt} "__metatable" |
| 117 | lua_rawseti(L_, kFQN, depth_); // L_: o "r" {c} {fqn} ... {?} k U {mt} | 117 | lua_rawseti(L_, kFQN, depth_); // L_: o "r" {c} {fqn} ... {?} k U {mt} |
| 118 | shortest_ = DiscoverObjectNameRecur(L_, shortest_, depth_); | 118 | shortest_ = DiscoverObjectNameRecur(L_, shortest_, depth_); |
| 119 | lua_pushnil(L_); // L_: o "r" {c} {fqn} ... {?} k U {mt} nil | 119 | lua_pushnil(L_); // L_: o "r" {c} {fqn} ... {?} k U {mt} nil |
| @@ -129,7 +129,7 @@ THE SOFTWARE. | |||
| 129 | while (lua_getiuservalue(L_, -1, _uvi) != LUA_TNONE) { // L_: o "r" {c} {fqn} ... {?} k U {u} | 129 | while (lua_getiuservalue(L_, -1, _uvi) != LUA_TNONE) { // L_: o "r" {c} {fqn} ... {?} k U {u} |
| 130 | if (lua_istable(L_, -1)) { // if it is a table, look inside | 130 | if (lua_istable(L_, -1)) { // if it is a table, look inside |
| 131 | ++depth_; | 131 | ++depth_; |
| 132 | lua_pushliteral(L_, "uservalue"); // L_: o "r" {c} {fqn} ... {?} k v {u} "uservalue" | 132 | luaG_pushstring(L_, "uservalue"); // L_: o "r" {c} {fqn} ... {?} k v {u} "uservalue" |
| 133 | lua_rawseti(L_, kFQN, depth_); // L_: o "r" {c} {fqn} ... {?} k v {u} | 133 | lua_rawseti(L_, kFQN, depth_); // L_: o "r" {c} {fqn} ... {?} k v {u} |
| 134 | shortest_ = DiscoverObjectNameRecur(L_, shortest_, depth_); | 134 | shortest_ = DiscoverObjectNameRecur(L_, shortest_, depth_); |
| 135 | lua_pushnil(L_); // L_: o "r" {c} {fqn} ... {?} k v {u} nil | 135 | lua_pushnil(L_); // L_: o "r" {c} {fqn} ... {?} k v {u} nil |
| @@ -188,14 +188,14 @@ LUAG_FUNC(nameof) | |||
| 188 | // push a table whose contents are strings that, when concatenated, produce unique name | 188 | // push a table whose contents are strings that, when concatenated, produce unique name |
| 189 | lua_newtable(L_); // L_: o nil {c} {fqn} | 189 | lua_newtable(L_); // L_: o nil {c} {fqn} |
| 190 | // {fqn}[1] = "_G" | 190 | // {fqn}[1] = "_G" |
| 191 | lua_pushliteral(L_, LUA_GNAME); // L_: o nil {c} {fqn} "_G" | 191 | luaG_pushstring(L_, LUA_GNAME); // L_: o nil {c} {fqn} "_G" |
| 192 | lua_rawseti(L_, -2, 1); // L_: o nil {c} {fqn} | 192 | lua_rawseti(L_, -2, 1); // L_: o nil {c} {fqn} |
| 193 | // this is where we start the search | 193 | // this is where we start the search |
| 194 | luaG_pushglobaltable(L_); // L_: o nil {c} {fqn} _G | 194 | luaG_pushglobaltable(L_); // L_: o nil {c} {fqn} _G |
| 195 | std::ignore = DiscoverObjectNameRecur(L_, std::numeric_limits<int>::max(), 1); | 195 | std::ignore = DiscoverObjectNameRecur(L_, std::numeric_limits<int>::max(), 1); |
| 196 | if (lua_isnil(L_, 2)) { // try again with registry, just in case... | 196 | if (lua_isnil(L_, 2)) { // try again with registry, just in case... |
| 197 | lua_pop(L_, 1); // L_: o nil {c} {fqn} | 197 | lua_pop(L_, 1); // L_: o nil {c} {fqn} |
| 198 | lua_pushliteral(L_, "_R"); // L_: o nil {c} {fqn} "_R" | 198 | luaG_pushstring(L_, "_R"); // L_: o nil {c} {fqn} "_R" |
| 199 | lua_rawseti(L_, -2, 1); // L_: o nil {c} {fqn} | 199 | lua_rawseti(L_, -2, 1); // L_: o nil {c} {fqn} |
| 200 | lua_pushvalue(L_, LUA_REGISTRYINDEX); // L_: o nil {c} {fqn} _R | 200 | lua_pushvalue(L_, LUA_REGISTRYINDEX); // L_: o nil {c} {fqn} _R |
| 201 | std::ignore = DiscoverObjectNameRecur(L_, std::numeric_limits<int>::max(), 1); | 201 | std::ignore = DiscoverObjectNameRecur(L_, std::numeric_limits<int>::max(), 1); |
diff --git a/src/state.cpp b/src/state.cpp index 6d27256..18c5ae2 100644 --- a/src/state.cpp +++ b/src/state.cpp | |||
| @@ -183,7 +183,7 @@ namespace state { | |||
| 183 | STACK_CHECK(L_, 1); | 183 | STACK_CHECK(L_, 1); |
| 184 | // capture error and raise it in caller state | 184 | // capture error and raise it in caller state |
| 185 | std::string_view const _stateType{ mode_ == LookupMode::LaneBody ? "lane" : "keeper" }; | 185 | std::string_view const _stateType{ mode_ == LookupMode::LaneBody ? "lane" : "keeper" }; |
| 186 | std::ignore = luaG_pushstring(L_, _stateType); // L_: on_state_create() "<type>" | 186 | luaG_pushstring(L_, _stateType); // L_: on_state_create() "<type>" |
| 187 | if (lua_pcall(L_, 1, 0, 0) != LUA_OK) { | 187 | if (lua_pcall(L_, 1, 0, 0) != LUA_OK) { |
| 188 | raise_luaL_error(from_, "%s failed: \"%s\"", kOnStateCreate.data(), lua_isstring(L_, -1) ? luaG_tostring(L_, -1).data() : luaG_typename(L_, -1).data()); | 188 | raise_luaL_error(from_, "%s failed: \"%s\"", kOnStateCreate.data(), lua_isstring(L_, -1) ? luaG_tostring(L_, -1).data() : luaG_typename(L_, -1).data()); |
| 189 | } | 189 | } |
| @@ -364,13 +364,13 @@ namespace state { | |||
| 364 | kLookupRegKey.pushValue(_L); // L: {} | 364 | kLookupRegKey.pushValue(_L); // L: {} |
| 365 | lua_pushnil(_L); // L: {} nil | 365 | lua_pushnil(_L); // L: {} nil |
| 366 | while (lua_next(_L, -2)) { // L: {} k v | 366 | while (lua_next(_L, -2)) { // L: {} k v |
| 367 | std::ignore = luaG_pushstring(_L, "["); // L: {} k v "[" | 367 | luaG_pushstring(_L, "["); // L: {} k v "[" |
| 368 | 368 | ||
| 369 | lua_getglobal(_L, "tostring"); // L: {} k v "[" tostring | 369 | lua_getglobal(_L, "tostring"); // L: {} k v "[" tostring |
| 370 | lua_pushvalue(_L, -4); // L: {} k v "[" tostring k | 370 | lua_pushvalue(_L, -4); // L: {} k v "[" tostring k |
| 371 | lua_call(_L, 1, 1); // L: {} k v "[" 'k' | 371 | lua_call(_L, 1, 1); // L: {} k v "[" 'k' |
| 372 | 372 | ||
| 373 | std::ignore = luaG_pushstring(_L, "] = "); // L: {} k v "[" 'k' "] = " | 373 | luaG_pushstring(_L, "] = "); // L: {} k v "[" 'k' "] = " |
| 374 | 374 | ||
| 375 | lua_getglobal(_L, "tostring"); // L: {} k v "[" 'k' "] = " tostring | 375 | lua_getglobal(_L, "tostring"); // L: {} k v "[" 'k' "] = " tostring |
| 376 | lua_pushvalue(_L, -5); // L: {} k v "[" 'k' "] = " tostring v | 376 | lua_pushvalue(_L, -5); // L: {} k v "[" 'k' "] = " tostring v |
diff --git a/src/tools.cpp b/src/tools.cpp index 3a331f5..9fc1e35 100644 --- a/src/tools.cpp +++ b/src/tools.cpp | |||
| @@ -323,9 +323,9 @@ namespace tools { | |||
| 323 | _name = "nullptr"; | 323 | _name = "nullptr"; |
| 324 | } | 324 | } |
| 325 | lua_pushvalue(L_, _in_base); // L_: {} f | 325 | lua_pushvalue(L_, _in_base); // L_: {} f |
| 326 | std::ignore = luaG_pushstring(L_, _name); // L_: {} f name_ | 326 | luaG_pushstring(L_, _name); // L_: {} f name_ |
| 327 | lua_rawset(L_, -3); // L_: {} | 327 | lua_rawset(L_, -3); // L_: {} |
| 328 | std::ignore = luaG_pushstring(L_, _name); // L_: {} name_ | 328 | luaG_pushstring(L_, _name); // L_: {} name_ |
| 329 | lua_pushvalue(L_, _in_base); // L_: {} name_ f | 329 | lua_pushvalue(L_, _in_base); // L_: {} name_ f |
| 330 | lua_rawset(L_, -3); // L_: {} | 330 | lua_rawset(L_, -3); // L_: {} |
| 331 | lua_pop(L_, 1); // L_: | 331 | lua_pop(L_, 1); // L_: |
| @@ -334,7 +334,7 @@ namespace tools { | |||
| 334 | int _startDepth{ 0 }; | 334 | int _startDepth{ 0 }; |
| 335 | if (!_name.empty()) { | 335 | if (!_name.empty()) { |
| 336 | STACK_CHECK(L_, 2); | 336 | STACK_CHECK(L_, 2); |
| 337 | std::ignore = luaG_pushstring(L_, _name); // L_: {} {fqn} "name" | 337 | luaG_pushstring(L_, _name); // L_: {} {fqn} "name" |
| 338 | // generate a name, and if we already had one name, keep whichever is the shorter | 338 | // generate a name, and if we already had one name, keep whichever is the shorter |
| 339 | lua_pushvalue(L_, _in_base); // L_: {} {fqn} "name" t | 339 | lua_pushvalue(L_, _in_base); // L_: {} {fqn} "name" t |
| 340 | update_lookup_entry(L_, _dbIdx, _startDepth); // L_: {} {fqn} "name" | 340 | update_lookup_entry(L_, _dbIdx, _startDepth); // L_: {} {fqn} "name" |
diff --git a/src/tracker.cpp b/src/tracker.cpp index ae4d116..315b56b 100644 --- a/src/tracker.cpp +++ b/src/tracker.cpp | |||
| @@ -94,7 +94,7 @@ void LaneTracker::tracking_add(Lane* lane_) | |||
| 94 | while (_lane != TRACKING_END) { | 94 | while (_lane != TRACKING_END) { |
| 95 | // insert a { name='<name>', status='<status>' } tuple, so that several lanes with the same name can't clobber each other | 95 | // insert a { name='<name>', status='<status>' } tuple, so that several lanes with the same name can't clobber each other |
| 96 | lua_createtable(L_, 0, 2); // L_: {} {} | 96 | lua_createtable(L_, 0, 2); // L_: {} {} |
| 97 | std::ignore = luaG_pushstring(L_, _lane->debugName); // L_: {} {} "name" | 97 | luaG_pushstring(L_, _lane->debugName); // L_: {} {} "name" |
| 98 | lua_setfield(L_, -2, "name"); // L_: {} {} | 98 | lua_setfield(L_, -2, "name"); // L_: {} {} |
| 99 | std::ignore = _lane->pushThreadStatus(L_); // L_: {} {} "status" | 99 | std::ignore = _lane->pushThreadStatus(L_); // L_: {} {} "status" |
| 100 | lua_setfield(L_, -2, "status"); // L_: {} {} | 100 | lua_setfield(L_, -2, "status"); // L_: {} {} |
diff --git a/src/uniquekey.h b/src/uniquekey.h index 94c09c7..debfee4 100644 --- a/src/uniquekey.h +++ b/src/uniquekey.h | |||
| @@ -105,16 +105,16 @@ class RegistryUniqueKey | |||
| 105 | return false; | 105 | return false; |
| 106 | } | 106 | } |
| 107 | // --------------------------------------------------------------------------------------------- | 107 | // --------------------------------------------------------------------------------------------- |
| 108 | void getSubTableMode(lua_State* const L_, char const* const mode_) const | 108 | void getSubTableMode(lua_State* const L_, std::string_view const& mode_) const |
| 109 | { | 109 | { |
| 110 | STACK_CHECK_START_REL(L_, 0); | 110 | STACK_CHECK_START_REL(L_, 0); |
| 111 | if (!getSubTable(L_, 0, 0)) { // L_: {} | 111 | if (!getSubTable(L_, 0, 0)) { // L_: {} |
| 112 | // Set its metatable if requested | 112 | // Set its metatable if requested |
| 113 | if (mode_) { | 113 | if (!mode_.empty()) { |
| 114 | STACK_GROW(L_, 3); | 114 | STACK_GROW(L_, 3); |
| 115 | lua_createtable(L_, 0, 1); // L_: {} mt | 115 | lua_createtable(L_, 0, 1); // L_: {} mt |
| 116 | lua_pushliteral(L_, "__mode"); // L_: {} mt "__mode" | 116 | luaG_pushstring(L_, "__mode"); // L_: {} mt "__mode" |
| 117 | lua_pushstring(L_, mode_); // L_: {} mt "__mode" mode | 117 | luaG_pushstring(L_, mode_); // L_: {} mt "__mode" mode |
| 118 | lua_rawset(L_, -3); // L_: {} mt | 118 | lua_rawset(L_, -3); // L_: {} mt |
| 119 | lua_setmetatable(L_, -2); // L_: {} | 119 | lua_setmetatable(L_, -2); // L_: {} |
| 120 | } | 120 | } |
diff --git a/src/universe.cpp b/src/universe.cpp index c95884f..c98e2c8 100644 --- a/src/universe.cpp +++ b/src/universe.cpp | |||
| @@ -131,7 +131,7 @@ Universe::Universe() | |||
| 131 | 131 | ||
| 132 | // Initialize 'timerLinda'; a common Linda object shared by all states | 132 | // Initialize 'timerLinda'; a common Linda object shared by all states |
| 133 | lua_pushcfunction(L_, LG_linda); // L_: settings lanes.linda | 133 | lua_pushcfunction(L_, LG_linda); // L_: settings lanes.linda |
| 134 | std::ignore = luaG_pushstring(L_, "lanes-timer"); // L_: settings lanes.linda "lanes-timer" | 134 | luaG_pushstring(L_, "lanes-timer"); // L_: settings lanes.linda "lanes-timer" |
| 135 | lua_pushinteger(L_, 0); // L_: settings lanes.linda "lanes-timer" 0 | 135 | lua_pushinteger(L_, 0); // L_: settings lanes.linda "lanes-timer" 0 |
| 136 | lua_call(L_, 2, 1); // L_: settings linda | 136 | lua_call(L_, 2, 1); // L_: settings linda |
| 137 | STACK_CHECK(L_, 1); | 137 | STACK_CHECK(L_, 1); |
