diff options
author | daurnimator <quae@daurnimator.com> | 2017-05-16 16:58:55 +1000 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-05-16 17:11:49 +1000 |
commit | a553ac00a4119eb247df5e123df60d447e96c31a (patch) | |
tree | 5d1fc1f492e8ccdd8f06e13467d1cc88e60903cd /src/lvm.js | |
parent | 4c7732b08043dc63ff195b0bc646cc184cefde41 (diff) | |
download | fengari-a553ac00a4119eb247df5e123df60d447e96c31a.tar.gz fengari-a553ac00a4119eb247df5e123df60d447e96c31a.tar.bz2 fengari-a553ac00a4119eb247df5e123df60d447e96c31a.zip |
src/lvm.js: Fix TODO for tointeger
Fixes `0.983 == 0` == true
Diffstat (limited to 'src/lvm.js')
-rw-r--r-- | src/lvm.js | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -713,8 +713,8 @@ const luaV_equalobj = function(L, t1, t2) { if (t1.ttnov() !== t2.ttnov() || t1.ttnov() !== CT.LUA_TNUMBER) return 0; /* only numbers can be equal with different variants */ else { /* two numbers with different variants */ - /* compare them as integers */ - return Math.floor(t1.value) === Math.floor(t2.value) ? 1 : 0; // TODO: tointeger + let i1, i2; /* compare them as integers */ + return (((i1 = luaV_tointeger(t1, 0)) !== false) && ((i2 = luaV_tointeger(t2, 0)) !== false) && (i1 === i2)) ? 1 : 0; } } |