aboutsummaryrefslogtreecommitdiff
path: root/src/lobject.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/lobject.js')
-rw-r--r--src/lobject.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lobject.js b/src/lobject.js
index 710a906..aeaa105 100644
--- a/src/lobject.js
+++ b/src/lobject.js
@@ -540,7 +540,7 @@ const intarith = function(L, op, v1, v2) {
case lua.LUA_OPADD: return (v1 + v2);
case lua.LUA_OPSUB: return (v1 - v2);
case lua.LUA_OPMUL: return (v1 * v2);
- case lua.LUA_OPMOD: return (v1 % v2);
+ case lua.LUA_OPMOD: return (v1 - Math.floor(v1 / v2) * v2); // % semantic on negative numbers is different in js
case lua.LUA_OPIDIV: return (v1 / v2);
case lua.LUA_OPBAND: return (v1 & v2);
case lua.LUA_OPBOR: return (v1 | v2);