summaryrefslogtreecommitdiff
path: root/src/lauxlib.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-04-26 17:40:14 +1000
committerdaurnimator <quae@daurnimator.com>2017-04-26 17:40:14 +1000
commit53bd1fcc4b90f24427064419354ad07c552a93d5 (patch)
tree3ecea12d668986709383f86353dbe9b434403a13 /src/lauxlib.js
parent992285ba12d217a3def72e49a29fba70e4e48f2f (diff)
downloadfengari-53bd1fcc4b90f24427064419354ad07c552a93d5.tar.gz
fengari-53bd1fcc4b90f24427064419354ad07c552a93d5.tar.bz2
fengari-53bd1fcc4b90f24427064419354ad07c552a93d5.zip
Remove lua.char
Diffstat (limited to 'src/lauxlib.js')
-rw-r--r--src/lauxlib.js19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/lauxlib.js b/src/lauxlib.js
index f2cf220..f3287f5 100644
--- a/src/lauxlib.js
+++ b/src/lauxlib.js
@@ -6,7 +6,6 @@ const assert = require('assert');
const lstate = require('./lstate.js');
const lapi = require('./lapi.js');
const lua = require('./lua.js');
-const char = lua.char;
const ldebug = require('./ldebug.js');
const lobject = require('./lobject.js');
@@ -57,7 +56,7 @@ const findfield = function(L, objidx, level) {
*/
const pushglobalfuncname = function(L, ar) {
let top = lapi.lua_gettop(L);
- ldebug.lua_getinfo(L, [char['f']], ar); /* push function */
+ ldebug.lua_getinfo(L, ['f'.charCodeAt(0)], ar); /* push function */
lapi.lua_getfield(L, lua.LUA_REGISTRYINDEX, lua.to_luastring(LUA_LOADED_TABLE, true));
if (findfield(L, top + 1, 2)) {
let name = lapi.lua_tostring(L, -1);
@@ -78,15 +77,15 @@ const sv = s => s ? s : [];
const pushfuncname = function(L, ar) {
if (pushglobalfuncname(L, ar)) { /* try first a global name */
- lapi.lua_pushstring(L, lua.to_luastring("function '", true).concat(lapi.lua_tostring(L, -1)).concat([char["'"]]));
+ lapi.lua_pushstring(L, lua.to_luastring("function '", true).concat(lapi.lua_tostring(L, -1)).concat(["'".charCodeAt(0)]));
lapi.lua_remove(L, -2); /* remove name */
}
else if (ar.namewhat) /* is there a name from code? */
- lapi.lua_pushstring(L, sv(ar.namewhat).concat(char[" "], char["'"], ...sv(ar.name.value), char["'"])); /* use it */
- else if (ar.what && ar.what[0] === char['m']) /* main? */
+ lapi.lua_pushstring(L, sv(ar.namewhat).concat(" ".charCodeAt(0), "'".charCodeAt(0), ...sv(ar.name.value), "'".charCodeAt(0))); /* use it */
+ else if (ar.what && ar.what[0] === 'm'.charCodeAt(0)) /* main? */
lapi.lua_pushliteral(L, "main chunk");
- else if (ar.what && ar.what[0] != char['C']) /* for Lua functions, use <file:line> */
- lapi.lua_pushstring(L, lua.to_luastring("function <", true).concat(...sv(ar.short_src), char[':'], ...lua.to_luastring(`${ar.linedefined}>`)));
+ else if (ar.what && ar.what[0] != 'C'.charCodeAt(0)) /* for Lua functions, use <file:line> */
+ lapi.lua_pushstring(L, lua.to_luastring("function <", true).concat(...sv(ar.short_src), ':'.charCodeAt(0), ...lua.to_luastring(`${ar.linedefined}>`)));
else /* nothing left... */
lapi.lua_pushliteral(L, "?");
};
@@ -112,7 +111,7 @@ const luaL_traceback = function(L, L1, msg, level) {
let last = lastlevel(L1);
let n1 = last - level > LEVELS1 + LEVELS2 ? LEVELS1 : -1;
if (msg)
- lapi.lua_pushstring(L, msg.concat(char['\n']));
+ lapi.lua_pushstring(L, msg.concat('\n'.charCodeAt(0)));
luaL_checkstack(L, 10, null);
lapi.lua_pushliteral(L, "stack traceback:");
while (ldebug.lua_getstack(L1, level++, ar)) {
@@ -121,7 +120,7 @@ const luaL_traceback = function(L, L1, msg, level) {
level = last - LEVELS2 + 1; /* and skip to last ones */
} else {
ldebug.lua_getinfo(L1, lua.to_luastring("Slnt", true), ar);
- lapi.lua_pushstring(L, [char['\n'], char['\t'], char['.'], char['.'], char['.']].concat(ar.short_src));
+ lapi.lua_pushstring(L, ['\n'.charCodeAt(0), '\t'.charCodeAt(0), '.'.charCodeAt(0), '.'.charCodeAt(0), '.'.charCodeAt(0)].concat(ar.short_src));
if (ar.currentline > 0)
lapi.lua_pushliteral(L, `${ar.currentline}:`);
lapi.lua_pushliteral(L, " in ");
@@ -153,7 +152,7 @@ const luaL_argerror = function(L, arg, extramsg) {
}
if (ar.name === null)
- ar.name = pushglobalfuncname(L, ar) ? lapi.lua_tostring(L, -1) : [lua.char["?"]];
+ ar.name = pushglobalfuncname(L, ar) ? lapi.lua_tostring(L, -1) : ["?".charCodeAt(0)];
return luaL_error(L, lua.to_luastring(`bad argument #${arg} to '${lobject.jsstring(ar.name)}' (${lobject.jsstring(extramsg)})`));
};