From 75d992c10e1ed49fe1af3ac72299c32edb9e07c3 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Thu, 2 Apr 2026 13:47:13 +0200 Subject: [PATCH] Support JS objects for spacelua.interpolate --- client/space_lua/stdlib/space_lua.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/space_lua/stdlib/space_lua.ts b/client/space_lua/stdlib/space_lua.ts index 678952ea..6835cb33 100644 --- a/client/space_lua/stdlib/space_lua.ts +++ b/client/space_lua/stdlib/space_lua.ts @@ -2,6 +2,7 @@ import { parseExpressionString } from "../parse.ts"; import type { LuaExpression } from "../ast.ts"; import { evalExpression } from "../eval.ts"; import { + jsToLuaValue, LuaBuiltinFunction, LuaEnv, LuaRuntimeError, @@ -129,7 +130,10 @@ export const spaceluaApi = new LuaTable({ * Interpolates a string with lua expressions and returns the result. */ interpolate: new LuaBuiltinFunction( - (sf, template: string, envAugmentation?: LuaTable) => { + (sf, template: string, envAugmentation?: LuaTable | any) => { + if (envAugmentation && !(envAugmentation instanceof LuaTable)) { + envAugmentation = jsToLuaValue(envAugmentation); + } return interpolateLuaString(sf, template, envAugmentation); }, ),