summaryrefslogtreecommitdiff
path: root/src/ltablib.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-04-24 12:01:42 +0200
committerBenoit Giannangeli <giann008@gmail.com>2017-04-24 12:09:49 +0200
commit656758c86ad929b07bb6422eb0f44cf9f2347aac (patch)
tree9463a52cfa7e49245054577804f1bd6dcaf22ff8 /src/ltablib.js
parentd15e00af0798783bdce5e27d2ab43de3ecb3fa4e (diff)
downloadfengari-656758c86ad929b07bb6422eb0f44cf9f2347aac.tar.gz
fengari-656758c86ad929b07bb6422eb0f44cf9f2347aac.tar.bz2
fengari-656758c86ad929b07bb6422eb0f44cf9f2347aac.zip
Use maximum 32bit number instead of Number.MAX_SAFE_INTEGER
Diffstat (limited to 'src/ltablib.js')
-rw-r--r--src/ltablib.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ltablib.js b/src/ltablib.js
index 0794887..bc51836 100644
--- a/src/ltablib.js
+++ b/src/ltablib.js
@@ -172,7 +172,7 @@ const unpack = function(L) {
let e = lauxlib.luaL_opt(L, lauxlib.luaL_checkinteger, 3, lauxlib.luaL_len(L, 1));
if (i > e) return 0; /* empty range */
let n = e - i; /* number of elements minus 1 (avoid overflows) */
- if (n >= Number.MAX_SAFE_INTEGER || !lapi.lua_checkstack(L, ++n))
+ if (n >= llimit.MAX_INT || !lapi.lua_checkstack(L, ++n))
return lauxlib.luaL_error(L, lua.to_luastring("too many results to unpack", true));
for (; i < e; i++) /* push arg[i..e - 1] (to avoid overflows) */
lapi.lua_geti(L, 1, i);
@@ -214,7 +214,7 @@ const auxsort = function(L) {
const sort = function(L) {
let n = aux_getn(L, 1, TAB_RW);
if (n > 1) { /* non-trivial interval? */
- lauxlib.luaL_argcheck(L, n < Number.MAX_SAFE_INTEGER, 1, lua.to_luastring("array too big", true));
+ lauxlib.luaL_argcheck(L, n < llimit.MAX_INT, 1, lua.to_luastring("array too big", true));
if (!lapi.lua_isnoneornil(L, 2)) /* is there a 2nd argument? */
lauxlib.luaL_checktype(L, 2, CT.LUA_TFUNCTION); /* must be a function */
lapi.lua_settop(L, 2); /* make sure there are two arguments */