summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
Diffstat (limited to 'server/src')
-rw-r--r--server/src/core/vm.lua12
1 files changed, 9 insertions, 3 deletions
diff --git a/server/src/core/vm.lua b/server/src/core/vm.lua
index b490ccf9..36a8f21b 100644
--- a/server/src/core/vm.lua
+++ b/server/src/core/vm.lua
@@ -1118,13 +1118,19 @@ function mt:getBinary(exp)
elseif op == '*' then
return self:createValue('number', nil, v1.value * v2.value)
elseif op == '/' then
- return self:createValue('number', nil, v1.value / v2.value)
+ if v2.value ~= 0 then
+ return self:createValue('number', nil, v1.value / v2.value)
+ end
elseif op == '^' then
return self:createValue('number', nil, v1.value ^ v2.value)
elseif op == '%' then
- return self:createValue('number', nil, v1.value % v2.value)
+ if v2.value ~= 0 then
+ return self:createValue('number', nil, v1.value % v2.value)
+ end
elseif op == '//' then
- return self:createValue('number', nil, v1.value // v2.value)
+ if v2.value ~= 0 then
+ return self:createValue('number', nil, v1.value // v2.value)
+ end
end
end
return self:createValue('number')