aboutsummaryrefslogtreecommitdiff
path: root/src/state.cpp
diff options
context:
space:
mode:
authorBenoit Germain <benoit.germain@ubisoft.com>2024-06-14 17:00:01 +0200
committerBenoit Germain <benoit.germain@ubisoft.com>2024-06-14 17:00:01 +0200
commit7d65cec0385b6dcaf3346d3f862efb5eb07ad14a (patch)
tree230de536a854b62017c54d3dffdd147f68bda0e4 /src/state.cpp
parent28ffb99fe2d9a4df1c60d35a39de47992076167f (diff)
downloadlanes-7d65cec0385b6dcaf3346d3f862efb5eb07ad14a.tar.gz
lanes-7d65cec0385b6dcaf3346d3f862efb5eb07ad14a.tar.bz2
lanes-7d65cec0385b6dcaf3346d3f862efb5eb07ad14a.zip
Handle std::ignore cases that should not be ignored
Diffstat (limited to 'src/state.cpp')
-rw-r--r--src/state.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/state.cpp b/src/state.cpp
index 18c5ae2..267554e 100644
--- a/src/state.cpp
+++ b/src/state.cpp
@@ -167,7 +167,7 @@ namespace state {
167 DEBUGSPEW_CODE(DebugSpew(U_) << "calling on_state_create()" << std::endl); 167 DEBUGSPEW_CODE(DebugSpew(U_) << "calling on_state_create()" << std::endl);
168 if (U_->onStateCreateFunc != reinterpret_cast<lua_CFunction>(InitializeOnStateCreate)) { 168 if (U_->onStateCreateFunc != reinterpret_cast<lua_CFunction>(InitializeOnStateCreate)) {
169 // C function: recreate a closure in the new state, bypassing the lookup scheme 169 // C function: recreate a closure in the new state, bypassing the lookup scheme
170 lua_pushcfunction(L_, U_->onStateCreateFunc); // on_state_create() 170 lua_pushcfunction(L_, U_->onStateCreateFunc); // on_state_create()
171 } else { // Lua function located in the config table, copied when we opened "lanes.core" 171 } else { // Lua function located in the config table, copied when we opened "lanes.core"
172 if (mode_ != LookupMode::LaneBody) { 172 if (mode_ != LookupMode::LaneBody) {
173 // if attempting to call in a keeper state, do nothing because the function doesn't exist there 173 // if attempting to call in a keeper state, do nothing because the function doesn't exist there
@@ -177,7 +177,10 @@ namespace state {
177 } 177 }
178 kConfigRegKey.pushValue(L_); // L_: {} 178 kConfigRegKey.pushValue(L_); // L_: {}
179 STACK_CHECK(L_, 1); 179 STACK_CHECK(L_, 1);
180 std::ignore = luaG_getfield(L_, -1, kOnStateCreate); // L_: {} on_state_create() 180 LuaType const _funcType{ luaG_getfield(L_, -1, kOnStateCreate) }; // L_: {} on_state_create()
181 if (_funcType != LuaType::FUNCTION) {
182 raise_luaL_error(L_, "INTERNAL ERROR: %s is a %s, not a function", kOnStateCreate.data(), luaG_typename(L_, _funcType).data());
183 }
181 lua_remove(L_, -2); // L_: on_state_create() 184 lua_remove(L_, -2); // L_: on_state_create()
182 } 185 }
183 STACK_CHECK(L_, 1); 186 STACK_CHECK(L_, 1);