diff options
Diffstat (limited to 'script/vm/operator.lua')
-rw-r--r-- | script/vm/operator.lua | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/script/vm/operator.lua b/script/vm/operator.lua index 9dea01c1..015eba38 100644 --- a/script/vm/operator.lua +++ b/script/vm/operator.lua @@ -273,7 +273,7 @@ vm.binarySwitch = util.switch() or op == '//' and a // b or op == '^' and a ^ b vm.setNode(source, { - type = math.type(result) == 'integer' and 'integer' or 'number', + type = (op == '//' or math.type(result) == 'integer') and 'integer' or 'number', start = source.start, finish = source.finish, parent = source, @@ -288,7 +288,6 @@ vm.binarySwitch = util.switch() if op == '+' or op == '-' or op == '*' - or op == '//' or op == '%' then local uri = guide.getUri(source) local infer1 = vm.getInfer(source[1]) @@ -302,6 +301,10 @@ vm.binarySwitch = util.switch() end end end + if op == '//' then + vm.setNode(source, node or vm.declareGlobal('type', 'integer')) + return + end vm.setNode(source, node or vm.declareGlobal('type', 'number')) end end) |