summaryrefslogtreecommitdiff
path: root/src/lvm.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-15 07:45:45 +0100
committerBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-15 07:45:45 +0100
commit1c19f45c6b537dacfc0d57999d57cd4eef9399e9 (patch)
tree8d335312dbf4c663db129443093e68e3c0afc0b4 /src/lvm.js
parent829e47b9bd568c5722e9f59ca05036d2ae912ddf (diff)
downloadfengari-1c19f45c6b537dacfc0d57999d57cd4eef9399e9.tar.gz
fengari-1c19f45c6b537dacfc0d57999d57cd4eef9399e9.tar.bz2
fengari-1c19f45c6b537dacfc0d57999d57cd4eef9399e9.zip
__le, __lt, __eq
Diffstat (limited to 'src/lvm.js')
-rw-r--r--src/lvm.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lvm.js b/src/lvm.js
index cd9548e..815ca2f 100644
--- a/src/lvm.js
+++ b/src/lvm.js
@@ -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;