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/lauxlib.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/lauxlib.js')
-rw-r--r-- | src/lauxlib.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lauxlib.js b/src/lauxlib.js index 0c42a05..32dd37c 100644 --- a/src/lauxlib.js +++ b/src/lauxlib.js @@ -56,7 +56,7 @@ const findfield = function(L, objidx, level) { */ const pushglobalfuncname = function(L, ar) { let top = lua.lua_gettop(L); - lua.lua_getinfo(L, ['f'.charCodeAt(0)], ar); /* push function */ + lua.lua_getinfo(L, lua.to_luastring("f"), ar); /* push function */ lua.lua_getfield(L, lua.LUA_REGISTRYINDEX, LUA_LOADED_TABLE); if (findfield(L, top + 1, 2)) { let name = lua.lua_tostring(L, -1); @@ -146,7 +146,7 @@ const luaL_argerror = function(L, arg, extramsg) { if (!lua.lua_getstack(L, 0, ar)) /* no stack frame? */ return luaL_error(L, lua.to_luastring("bad argument #%d (%s)"), arg, extramsg); - lua.lua_getinfo(L, ['n'.charCodeAt(0)], ar); + lua.lua_getinfo(L, lua.to_luastring("n"), ar); if (ar.namewhat.join() === lua.to_luastring("method").join()) { arg--; /* do not count 'self' */ @@ -155,7 +155,7 @@ const luaL_argerror = function(L, arg, extramsg) { } if (ar.name === null) - ar.name = pushglobalfuncname(L, ar) ? lua.lua_tostring(L, -1) : ["?".charCodeAt(0)]; + ar.name = pushglobalfuncname(L, ar) ? lua.lua_tostring(L, -1) : lua.to_luastring("?"); return luaL_error(L, lua.to_luastring("bad argument #%d to '%s' (%s)"), arg, ar.name, extramsg); }; @@ -182,7 +182,7 @@ const luaL_where = function(L, level) { return; } } - lua.lua_pushstring(L, []); + lua.lua_pushstring(L, lua.to_luastring("")); }; const luaL_error = function(L, fmt, ...argp) { |