diff options
-rw-r--r-- | src/lvm.js | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -646,18 +646,20 @@ const luaV_lessthan = function(L, l, r) { }; 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 { - let res = ltm.luaT_callorderTM(L, l, r, ltm.TMS.TM_LE); + 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' */ - let res = ltm.luaT_callorderTM(L, r, l, ltm.TMS.TM_LT); + res = ltm.luaT_callorderTM(L, r, l, ltm.TMS.TM_LT); L.ci.callstatus ^= lstate.CIST_LEQ; /* clear mark */ if (res === null) ldebug.luaG_ordererror(L, l, r); |