Execute metatable destructor in Table::set_metatable at the end of invocation

Before this change, destructor was executed shortly after pushing metatable to ref_thread.
This commit is contained in:
Alex Orlenko
2025-07-15 19:14:46 +01:00
parent 459edb6816
commit f945a35cbd
+1 -1
View File
@@ -510,7 +510,7 @@ impl Table {
let lua = self.0.lua.lock();
let ref_thread = lua.ref_thread();
unsafe {
if let Some(metatable) = metatable {
if let Some(metatable) = &metatable {
ffi::lua_pushvalue(ref_thread, metatable.0.index);
} else {
ffi::lua_pushnil(ref_thread);