aboutsummaryrefslogtreecommitdiff
path: root/src/loadlib.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-04 11:28:08 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-04 11:37:21 +1000
commitc811e3e58e9152e2c86df148628aec47f56d0cf9 (patch)
treeb5e03986b5ce89ec13ddfc4d4c893366572555ee /src/loadlib.js
parent0447737eaa41565c8ffddbe3ec5650ce148c4be8 (diff)
downloadfengari-c811e3e58e9152e2c86df148628aec47f56d0cf9.tar.gz
fengari-c811e3e58e9152e2c86df148628aec47f56d0cf9.tar.bz2
fengari-c811e3e58e9152e2c86df148628aec47f56d0cf9.zip
src/loadlib.js: Fix incorrect args for package functions
Diffstat (limited to 'src/loadlib.js')
-rw-r--r--src/loadlib.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/loadlib.js b/src/loadlib.js
index 15b835d..7213796 100644
--- a/src/loadlib.js
+++ b/src/loadlib.js
@@ -173,7 +173,7 @@ const setpath = function(L, fieldname, envname, dft) {
.concat(AUXMARK)
.concat(lua.to_luastring(lua.LUA_PATH_SEP, true))
);
- lauxlib.luaL_gsub(L, path, AUXMARK, dft);
+ lauxlib.luaL_gsub(L, path, AUXMARK, lua.to_luastring(dft));
lua.lua_remove(L, -2); /* remove result from 1st 'gsub' */
}
lua.lua_setfield(L, -3, fieldname); /* package[fieldname] = path value */
@@ -225,7 +225,7 @@ const searchpath = function(L, name, path, sep, dirsep) {
lua.lua_remove(L, -1); /* remove file name */
msg.push(...lua.to_luastring(`\n\tno file '${lua.to_jsstring(filename)}'`));
}
- lua.lua_pushstring(msg); /* create error message */
+ lua.lua_pushstring(L, msg); /* create error message */
return null; /* not found */
};
@@ -335,8 +335,8 @@ const findloader = function(L, name) {
for (let i = 1; ; i++) {
if (lua.lua_rawgeti(L, 3, i) === lua.LUA_TNIL) { /* no more searchers? */
lua.lua_pop(L, 1); /* remove nil */
- lua.lua_pushstring(msg); /* create error message */
- lauxlib.luaL_error(L, `module '${lua.to_jsstring(name)}' not found:${lua.lua_tojsstring(L, -1)}`);
+ lua.lua_pushstring(L, msg); /* create error message */
+ lauxlib.luaL_error(L, lua.to_luastring(`module '${lua.to_jsstring(name)}' not found:${lua.lua_tojsstring(L, -1)}`));
}
lua.lua_pushstring(L, name);
lua.lua_call(L, 1, 2); /* call it */