summaryrefslogtreecommitdiff
path: root/src/lua
diff options
context:
space:
mode:
authorailurux <ailuruxx@gmail.com>2024-04-08 15:40:16 +1000
committerailurux <ailuruxx@gmail.com>2024-04-08 15:40:16 +1000
commitf20ca9583af5312eea65cf144803d00be6e50602 (patch)
treed6047ff952d6ad60a30ba038e6a5c72c64b8b0e7 /src/lua
parent01ae3fee30704577f4ea37ed7f2132990135163c (diff)
parent96b62321c33ff5e146d52416dc5da3f0c240b4b0 (diff)
downloadtangara-fw-f20ca9583af5312eea65cf144803d00be6e50602.tar.gz
Merge branch 'main' of codeberg.org:cool-tech-zone/tangara-fw
Diffstat (limited to 'src/lua')
-rw-r--r--src/lua/property.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lua/property.cpp b/src/lua/property.cpp
index 200f4d5c..e136ad90 100644
--- a/src/lua/property.cpp
+++ b/src/lua/property.cpp
@@ -379,22 +379,22 @@ auto Property::Update(const LuaValue& v) -> void {
for (int i = bindings_.size() - 1; i >= 0; i--) {
auto& b = bindings_[i];
+ int top = lua_gettop(b.first);
+
lua_pushstring(b.first, kBindingsTable);
lua_gettable(b.first, LUA_REGISTRYINDEX); // REGISTRY[kBindingsTable]
int type = lua_rawgeti(b.first, -1, b.second); // push bindings[i]
// Has closure has been GCed?
if (type == LUA_TNIL) {
- // Clean up after ourselves.
- lua_pop(b.first, 1);
// Remove the binding.
bindings_.erase(bindings_.begin() + i);
- continue;
+ } else {
+ PushValue(*b.first); // push the argument
+ CallProtected(b.first, 1, 0); // invoke the closure
}
- PushValue(*b.first); // push the argument
- CallProtected(b.first, 1, 0); // invoke the closure
- lua_pop(b.first, 1); // pop the bindings table
+ lua_settop(b.first, top); // clean up after ourselves
}
}