diff options
author | daurnimator <quae@daurnimator.com> | 2017-12-12 15:03:02 +1100 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-12-13 15:03:54 +1100 |
commit | e438f10592077f8b5432f67ef72a8f1bfbbcdc49 (patch) | |
tree | 7755e33334b592e78bc76a20a47fb5e504fe7c74 /src/loadlib.js | |
parent | c5b39b9d292c1a2178aa41c6a95367a81614eb61 (diff) | |
download | fengari-e438f10592077f8b5432f67ef72a8f1bfbbcdc49.tar.gz fengari-e438f10592077f8b5432f67ef72a8f1bfbbcdc49.tar.bz2 fengari-e438f10592077f8b5432f67ef72a8f1bfbbcdc49.zip |
src/: Use to_luastring more often instead of manually creating arrays
Diffstat (limited to 'src/loadlib.js')
-rw-r--r-- | src/loadlib.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/loadlib.js b/src/loadlib.js index a64f1c3..bae5db1 100644 --- a/src/loadlib.js +++ b/src/loadlib.js @@ -26,7 +26,7 @@ const LUA_POF = lua.to_luastring("luaopen_"); const LUA_OFSEP = lua.to_luastring("_"); const LIB_FAIL = "open"; -const AUXMARK = [1]; +const AUXMARK = lua.to_luastring("\x01"); /* @@ -277,8 +277,8 @@ const ll_searchpath = function(L) { L, lauxlib.luaL_checkstring(L, 1), lauxlib.luaL_checkstring(L, 2), - lauxlib.luaL_optstring(L, 3, [".".charCodeAt(0)]), - lauxlib.luaL_optstring(L, 4, [lua.LUA_DIRSEP.charCodeAt(0)]) + lauxlib.luaL_optstring(L, 3, lua.to_luastring(".")), + lauxlib.luaL_optstring(L, 4, lua.to_luastring(lua.LUA_DIRSEP)) ); if (f !== null) return 1; else { /* error message is on top of the stack */ @@ -293,7 +293,7 @@ const findfile = function(L, name, pname, dirsep) { let path = lua.lua_tostring(L, -1); if (path === null) lauxlib.luaL_error(L, lua.to_luastring("'package.%s' must be a string"), pname); - return searchpath(L, name, path, ['.'.charCodeAt(0)], dirsep); + return searchpath(L, name, path, lua.to_luastring("."), dirsep); }; const checkload = function(L, stat, filename) { @@ -322,7 +322,7 @@ const searcher_Lua = function(L) { */ const loadfunc = function(L, filename, modname) { let openfunc; - modname = lauxlib.luaL_gsub(L, modname, [".".charCodeAt(0)], LUA_OFSEP); + modname = lauxlib.luaL_gsub(L, modname, lua.to_luastring("."), LUA_OFSEP); let mark = modname.indexOf(LUA_IGMARK.charCodeAt(0)); if (mark >= 0) { openfunc = lua.lua_pushlstring(L, modname, mark); |