diff options
author | Benoit Giannangeli <benoit.giannangeli@boursorama.fr> | 2017-02-15 07:45:45 +0100 |
---|---|---|
committer | Benoit Giannangeli <benoit.giannangeli@boursorama.fr> | 2017-02-15 07:45:45 +0100 |
commit | 1c19f45c6b537dacfc0d57999d57cd4eef9399e9 (patch) | |
tree | 8d335312dbf4c663db129443093e68e3c0afc0b4 /src | |
parent | 829e47b9bd568c5722e9f59ca05036d2ae912ddf (diff) | |
download | fengari-1c19f45c6b537dacfc0d57999d57cd4eef9399e9.tar.gz fengari-1c19f45c6b537dacfc0d57999d57cd4eef9399e9.tar.bz2 fengari-1c19f45c6b537dacfc0d57999d57cd4eef9399e9.zip |
__le, __lt, __eq
Diffstat (limited to 'src')
-rw-r--r-- | src/ltm.js | 2 | ||||
-rw-r--r-- | src/lvm.js | 10 |
2 files changed, 6 insertions, 6 deletions
@@ -79,7 +79,7 @@ const luaT_trybinTM = function(L, p1, p2, res, event) { }; const luaT_callorderTM = function(L, p1, p2, event) { - if (!luaT_callbinTM(L, p2, p2, L.top, event)) + if (!luaT_callbinTM(L, p1, p2, L.top, event)) return -1; else return !L.stack[L.top].l_isfalse() ? 1 : 0; @@ -662,7 +662,7 @@ const luaV_lessthan = function(L, l, r) { else if (l.ttisstring() && r.ttisstring()) return l_strcmp(l, r) < 0; else { - let res = ltm.luatT_callorderTM(L, l, r, TMS.TM_LT); + let res = ltm.luaT_callorderTM(L, l, r, TMS.TM_LT); if (res < 0) throw new Error("TM order error"); // TODO: luaG_ordererror return res; @@ -677,17 +677,17 @@ const luaV_lessequal = function(L, l, r) { else if (l.ttisstring() && r.ttisstring()) return l_strcmp(l, r) <= 0; else { - res = ltm.luatT_callorderTM(L, l, r, TMS.TM_LE); + res = ltm.luaT_callorderTM(L, l, r, TMS.TM_LE); if (res >= 0) return res; } L.ci.callstatus |= lstate.CIST_LEQ; /* mark it is doing 'lt' for 'le' */ - res = ltm.luatT_callorderTM(L, l, r, TMS.TM_LT); + res = ltm.luaT_callorderTM(L, l, r, TMS.TM_LT); L.ci.callstatus ^= lstate.CIST_LEQ; /* clear mark */ if (res < 0) throw new Error("TM order error"); // TODO: luaG_ordererror - return res === 1; + return res !== 1 ? 1 : 0; /* result is negated */ }; const luaV_equalobj = function(L, t1, t2) { @@ -709,11 +709,11 @@ const luaV_equalobj = function(L, t1, t2) { case CT.LUA_TNUMINT: case CT.LUA_TNUMFLT: case CT.LUA_TBOOLEAN: - case CT.LUA_TLIGHTUSERDATA: case CT.LUA_TLCF: case CT.LUA_TSHRSTR: case CT.LUA_TLNGSTR: return t1.value === t2.value ? 1 : 0; + case CT.LUA_TLIGHTUSERDATA: case CT.LUA_TUSERDATA: case CT.LUA_TTABLE: if (t1 === t2) return 1; |