Lua fixes

pull/1212/head^2
Zef Hemel 2025-01-17 18:32:13 +01:00
parent 6a65912b94
commit 6d42423e8d
2 changed files with 11 additions and 8 deletions

View File

@ -30,7 +30,10 @@ import { templateApi } from "$common/space_lua/stdlib/template.ts";
import { mathApi } from "$common/space_lua/stdlib/math.ts";
const printFunction = new LuaBuiltinFunction(async (_sf, ...args) => {
console.log("[Lua]", ...(await Promise.all(args.map(luaToString))));
console.log(
"[Lua]",
...(await Promise.all(args.map((v) => luaToString(v)))),
);
});
const assertFunction = new LuaBuiltinFunction(

View File

@ -120,15 +120,15 @@ function exposeDefinitions(
);
}
async function buildThreadLocalEnv(system: System<any>, globalEnv: LuaEnv) {
function buildThreadLocalEnv(_system: System<any>, globalEnv: LuaEnv) {
const tl = new LuaEnv();
const currentPageMeta = await system.localSyscall(
"editor.getCurrentPageMeta",
[],
);
tl.setLocal("pageMeta", currentPageMeta);
// const currentPageMeta = await system.localSyscall(
// "editor.getCurrentPageMeta",
// [],
// );
// tl.setLocal("pageMeta", currentPageMeta);
tl.setLocal("_GLOBAL", globalEnv);
return tl;
return Promise.resolve(tl);
}
async function handleLuaError(e: any, system: System<any>) {