summaryrefslogtreecommitdiff
path: root/src/lobject.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-21 18:56:10 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-21 19:12:50 +1000
commitbdaa2a67b491bfc1d9521778cb3d13d386f97f93 (patch)
tree8ce64bbf6a390250547d6427bc10595664bd1ced /src/lobject.js
parentd229ba6542aa009185b28530c55887d14c76b163 (diff)
downloadfengari-bdaa2a67b491bfc1d9521778cb3d13d386f97f93.tar.gz
fengari-bdaa2a67b491bfc1d9521778cb3d13d386f97f93.tar.bz2
fengari-bdaa2a67b491bfc1d9521778cb3d13d386f97f93.zip
Use same mod operator behaviour from both lvm.js and lobject.js
Diffstat (limited to 'src/lobject.js')
-rw-r--r--src/lobject.js6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/lobject.js b/src/lobject.js
index ec88e34..6d86852 100644
--- a/src/lobject.js
+++ b/src/lobject.js
@@ -545,11 +545,7 @@ const numarith = function(L, op, v1, v2) {
case defs.LUA_OPPOW: return Math.pow(v1, v2);
case defs.LUA_OPIDIV: return Math.floor(v1 / v2);
case defs.LUA_OPUNM: return -v1;
- case defs.LUA_OPMOD:
- let m = v1 % v2;
- if ((m*v2) < 0)
- m += v2;
- return m;
+ case defs.LUA_OPMOD: return llimit.luai_nummod(L, v1, v2);
default: assert(0);
}
};