summaryrefslogtreecommitdiff
path: root/src/lvm.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-26 15:54:47 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-27 22:43:20 +1000
commit63446e402d2aa70bb53cbc40563edafb6383cf5d (patch)
tree7b3dcc3037237e68c4c6cd126dc28e5434ceb8df /src/lvm.js
parented0518f417a61b32e531f85c434b8024859202cd (diff)
downloadfengari-63446e402d2aa70bb53cbc40563edafb6383cf5d.tar.gz
fengari-63446e402d2aa70bb53cbc40563edafb6383cf5d.tar.bz2
fengari-63446e402d2aa70bb53cbc40563edafb6383cf5d.zip
Have ltm.luaT_callorderTM return a boolean
Diffstat (limited to 'src/lvm.js')
-rw-r--r--src/lvm.js14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/lvm.js b/src/lvm.js
index 724f689..9bbe768 100644
--- a/src/lvm.js
+++ b/src/lvm.js
@@ -752,31 +752,29 @@ const luaV_lessthan = function(L, l, r) {
return l_strcmp(l.tsvalue(), r.tsvalue()) < 0 ? 1 : 0;
else {
let res = ltm.luaT_callorderTM(L, l, r, ltm.TMS.TM_LT);
- if (res < 0)
+ if (res === null)
ldebug.luaG_ordererror(L, l, r);
return res ? 1 : 0;
}
};
const luaV_lessequal = function(L, l, r) {
- let res;
-
if (l.ttisnumber() && r.ttisnumber())
return LEnum(l, r) ? 1 : 0;
else if (l.ttisstring() && r.ttisstring())
return l_strcmp(l.tsvalue(), r.tsvalue()) <= 0 ? 1 : 0;
else {
- res = ltm.luaT_callorderTM(L, l, r, ltm.TMS.TM_LE);
- if (res >= 0)
+ let res = ltm.luaT_callorderTM(L, l, r, ltm.TMS.TM_LE);
+ if (res !== null)
return res ? 1 : 0;
}
/* try 'lt': */
L.ci.callstatus |= lstate.CIST_LEQ; /* mark it is doing 'lt' for 'le' */
- res = ltm.luaT_callorderTM(L, r, l, ltm.TMS.TM_LT);
+ let res = ltm.luaT_callorderTM(L, r, l, ltm.TMS.TM_LT);
L.ci.callstatus ^= lstate.CIST_LEQ; /* clear mark */
- if (res < 0)
+ if (res === null)
ldebug.luaG_ordererror(L, l, r);
- return res !== 1 ? 1 : 0; /* result is negated */
+ return res ? 0 : 1; /* result is negated */
};
const luaV_equalobj = function(L, t1, t2) {