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/intercopycontext.cpp | |
| parent | a925a9ee21c10184a08625e83d2b55850d6cb32f (diff) | |
| download | lanes-4d364d3e77667b70bf3261da004f4990ef0c3ada.tar.gz lanes-4d364d3e77667b70bf3261da004f4990ef0c3ada.tar.bz2 lanes-4d364d3e77667b70bf3261da004f4990ef0c3ada.zip | |
lua_pushliteral -> luaG_pushstring
Diffstat (limited to 'src/intercopycontext.cpp')
| -rw-r--r-- | src/intercopycontext.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
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 | ||
