The file newtest.lua contains:
local myFile, err = io.open('/tmp/file.txt') print(myFile) print(err) io.input(myFile) theContent = io.read('*all') print(theContent)
var fs = require('fs'); theFileContent = fs.readFileSync("./newtest.lua", "utf8"); var LuaVM = require('lua.vm.js'); var l = new LuaVM.Lua.State(); l.execute(theFileContent);
If I simply execute:
as expected, I get the content of '/tmp/file.txt' printed on the console.
But If I run the same code from the nw-based app, I don't get anything: nothing on the output console and not even the global variable theContent set to the right value
myFile is nil and err is /tmp/file.txt: No such file or directory
But the file is right there.
I am starting to think that the lua code executed by lua.vm.js does not allow io operations. Any idea?
UPDATE I tried to run a simple node app (removing nodewebkit from the picture). This is the example.js I am running