diff options
Diffstat (limited to 'src/lvm.js')
-rw-r--r-- | src/lvm.js | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -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; |