summaryrefslogtreecommitdiff
path: root/src/lauxlib.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-04-19 10:38:44 +0200
committerBenoit Giannangeli <giann008@gmail.com>2017-04-19 10:38:44 +0200
commit8966842ba72fb1eef351355ead2e8950fd87141a (patch)
tree94909de8fef3430c0f20e8c5eb88c814ce61c679 /src/lauxlib.js
parenta02f4e93b92e7ebb7ef038ad151e51652b0ce84d (diff)
parent662381f6669f28f90a1d50c89647d265ca3804a4 (diff)
downloadfengari-8966842ba72fb1eef351355ead2e8950fd87141a.tar.gz
fengari-8966842ba72fb1eef351355ead2e8950fd87141a.tar.bz2
fengari-8966842ba72fb1eef351355ead2e8950fd87141a.zip
Merge branch 'master' into feature/lua-tests
Diffstat (limited to 'src/lauxlib.js')
-rw-r--r--src/lauxlib.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lauxlib.js b/src/lauxlib.js
index 064e229..3d75282 100644
--- a/src/lauxlib.js
+++ b/src/lauxlib.js
@@ -513,7 +513,7 @@ if (typeof require === "function") {
const errfile = function(L, what, fnameindex, error) {
let serr = error.message;
let filename = lapi.lua_tostring(L, fnameindex).slice(1);
- lapi.lua_pushstring(L, lua.to_luastring(`cannot ${lobject.jsstring(what)} ${lobject.jsstring(filename)}: ${lobject.jsstring(serr)}`));
+ lapi.lua_pushstring(L, lua.to_luastring(`cannot ${what} ${lobject.jsstring(filename)}: ${serr}`));
lapi.lua_remove(L, fnameindex);
return lua.thread_status.LUA_ERRFILE;
};
@@ -567,18 +567,18 @@ if (typeof require === "function") {
};
const luaL_loadfilex = function(L, filename, mode) {
- let jsfilename = lobject.jsstring(filename);
let lf = new LoadF();
let fnameindex = lapi.lua_gettop(L) + 1; /* index of filename on the stack */
if (filename === null) {
lapi.lua_pushliteral(L, "=stdin");
lf.f = process.stdin.fd;
} else {
+ let jsfilename = lobject.jsstring(filename);
lapi.lua_pushliteral(L, `@${jsfilename}`);
try {
lf.f = fs.openSync(jsfilename, "r");
} catch (e) {
- return errfile(L, lua.to_luastring("open", true), fnameindex, e);
+ return errfile(L, "open", fnameindex, e);
}
}
@@ -597,7 +597,7 @@ if (typeof require === "function") {
return status;
} catch (err) {
lapi.lua_settop(L, fnameindex); /* ignore results from 'lua_load' */
- return errfile(L, lua.to_luastring("read", true), fnameindex);
+ return errfile(L, "read", fnameindex, err);
}
};