geodata: reduce Lua matcher build allocations

This commit is contained in:
Meo597
2026-10-05 04:11:03 +08:00
parent e73fb0d500
commit 37d9894dde
2 changed files with 17 additions and 12 deletions
+2 -2
View File
@@ -29,11 +29,11 @@ func PushWithDirectMethods(L *glua.LState, value any, directMethods map[string]D
return callLuarMethod(L, original)
})
// Keep luar's method aliases on the same direct binding.
methods.ForEach(func(key, method glua.LValue) {
for key, method := methods.Next(glua.LNil); key != glua.LNil; key, method = methods.Next(key) {
if method == original {
methods.RawSet(key, fn)
}
})
}
}
metatable.RawSetString("__index", methods)
}