Skip to content

Commit

Permalink
Lua fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zefhemel committed Jan 17, 2025
1 parent 6a65912 commit 6d42423
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
5 changes: 4 additions & 1 deletion common/space_lua/stdlib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
14 changes: 7 additions & 7 deletions common/space_lua_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>) {
Expand Down

0 comments on commit 6d42423

Please sign in to comment.