From a6d4eb187b6c06f30112ecc872d2be6b2b298eb1 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Mon, 10 Nov 2025 15:33:26 +0100 Subject: [PATCH] Lua: Fix regression in `pairs` --- client/space_lua/stdlib.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/space_lua/stdlib.ts b/client/space_lua/stdlib.ts index dc80c79f..00b142bd 100644 --- a/client/space_lua/stdlib.ts +++ b/client/space_lua/stdlib.ts @@ -63,7 +63,7 @@ const pairsFunction = new LuaBuiltinFunction( let keys: (string | number)[]; if (Array.isArray(t)) { keys = Array.from({ length: t.length }, (_, i) => i + 1); // For arrays, generate 1-based indices - } else if (isLuaTable(t)) { + } else if (isLuaTable(t) || t instanceof LuaEnv) { keys = t.keys(); } else { // For plain JavaScript objects case, note: this will also include keys from the prototype