Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local input = {...}
- local num1 = input[1]
- local num2 = input[2]
- local op = input[3]
- local cop = false
- if op == "+" or op == "-" or op == "*" or op == "/" then
- cop = true
- end
- if tonumber(num1) == nil or tonumber(num2) == nil or cop == false or input[4] ~= null then
- print("Usage: calc %number1% %number2% %operator(+,-,*,/)%")
- elseif num2 == "0" and op == "/" then
- print("Can't devide by 0")
- elseif input[4] ~= null then
- print("To many arguments")
- else
- write("Result: ")
- if op == "+" then
- print(num1 + num2)
- elseif op == "-" then
- print(num1 - num2)
- elseif op == "*" then
- print(num1 * num2)
- else
- print(num1 / num2)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement