Closed pureliumy closed 12 months ago
I noticed there is a -l
option to include files when use CLI, and the internal method is factory.mountFile
. I will have a try with it.
I noticed there is a
-l
option to include files when use CLI, and the internal method isfactory.mountFile
. I will have a try with it.
Failed. Both CLI and factory.mountFile
.
wasmoon is sandboxed by default. You need to mount the file into it before requiring as a module.
wasmoon is sandboxed by default. You need to mount the file into it before requiring as a module.
Kindly asking what is the correct way to mount the file, I tried factory.mountFile
method, and it didn't work.
Kindly asking what is the correct way to mount the file, I tried
factory.mountFile
method, and it didn't work.
Can you make a minimal repro? factory.mountFile
should work just great.
I will say this was pretty confusing. I'm using it in the browser and I thought LuaEngine.doFile
was just for CLI usage. since there are no docs, showing an example with mountFile
would be very helpful!
factory.mountFile
with relative path name
like this: https://gist.github.com/a5b17f4459f40022af518742719a2e20.git
You can write you own require
function using javascript's fetch
, so you can get by without mounting every import file, I described it here.
If the lua string contains require statement,
doString
will fail because it can't find the required module.I tried to set a new
package.path
value, but it didn't work.Could anyone know how to deal with this situation?
Thanks!