summaryrefslogtreecommitdiff
path: root/src/llimit.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/llimit.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/llimit.js')
-rw-r--r--src/llimit.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/llimit.js b/src/llimit.js
index c8455b8..31862d0 100644
--- a/src/llimit.js
+++ b/src/llimit.js
@@ -8,6 +8,14 @@ module.exports.LUA_MAXINTEGER = LUA_MAXINTEGER;
const LUA_MININTEGER = -2147483648;
module.exports.LUA_MININTEGER = LUA_MININTEGER;
+const luai_nummod = function(L, a, b) {
+ let m = a % b;
+ if ((m*b) < 0)
+ m += b;
+ return m;
+};
+module.exports.luai_nummod = luai_nummod;
+
// If later integers are more than 32bit, LUA_MAXINTEGER will then be != MAX_INT
const MAX_INT = 2147483647;
module.exports.MAX_INT = MAX_INT;