Lua: support passing Lua function callbacks to native JS functions

This commit is contained in:
Zef Hemel
2025-03-14 10:02:25 +01:00
parent def7bf6a2f
commit f514ef1b53
12 changed files with 55 additions and 25 deletions
+2 -1
View File
@@ -85,6 +85,7 @@ export async function interpolateLuaString(
const env = createAugmentedEnv(sf, envAugmentation);
const luaResult = luaValueToJS(
await evalExpression(parsedExpr, env, sf),
sf,
);
result += luaToString(luaResult);
} catch (e: any) {
@@ -124,7 +125,7 @@ export const spaceluaApi = new LuaTable({
evalExpression: new LuaBuiltinFunction(
async (sf, parsedExpr: LuaExpression, envAugmentation?: LuaTable) => {
const env = createAugmentedEnv(sf, envAugmentation);
return luaValueToJS(await evalExpression(parsedExpr, env, sf));
return luaValueToJS(await evalExpression(parsedExpr, env, sf), sf);
},
),
/**