Skip to content

Commit 7f3b1e4

Browse files
committed
Don't try to fetch required lua files on playground
1 parent 5421829 commit 7f3b1e4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/pages/play/fengari.worker.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ export type LuaMessage = { type: "print"; text: string };
66

77
const workerContext = globalThis as typeof globalThis & { printStream: string[] };
88

9-
const redirectPrintStream = `
9+
const setupCode = `
10+
package.path = ""
11+
package.jspath = ""
12+
1013
local js = require("js")
1114
print = function(...)
1215
local elements = {}
@@ -46,7 +49,7 @@ function executeLua(code: string): LuaMessage[] {
4649
lualib.luaL_openlibs(L);
4750
lauxlib.luaL_requiref(L, to_luastring("js"), interop.luaopen_js, 1);
4851
lua.lua_pop(L, 1);
49-
lauxlib.luaL_dostring(L, to_luastring(redirectPrintStream));
52+
lauxlib.luaL_dostring(L, to_luastring(setupCode));
5053

5154
const status = lauxlib.luaL_dostring(L, to_luastring(code));
5255
const messageType = status === lua.LUA_OK ? "Module" : "Error";

0 commit comments

Comments
 (0)