SlashCalc allows any basic or advanced calculation, multiple calculations, and anything /script can do.
SlashCalc assigns the result of every calculation you make to a table. Access these calculations using $n where n is the index of that calculation (you'll see it when you do a calculation)
Examples
- /calc 10 + 5
- /calc $1 / 2
- /calc math.cos(math.pi / 4)
- /calc 1.718 ^ math.pi
- /calc (2.5 - $1) * $0
- /calc math.sin(2.13), math.cos(2.13), math.tan(2.13), 23 % 3
Usage
- SlashCalc uses Lua to execute the expression you enter. Any valid Lua is allowed. (Your input is turned into a function "/calc xyz" is equivalent to "return xyz;" with the exception of "$n" which is a shortcut to previous results.)
- SlashCalc assigns each result to a list. The list is not saved from session to session. To access these type "$number" into your expression.
- "$0" represents your last entry.
- "$1" is the result of the first calculation you made. "$2" is the second... etc.
- Separate multiple expressions with a comma to do multiple calculations on a single line. You will see the result of each expression.
- NEW: You can omit the leading "$0" if you start your input with the binary operators +, *, :, %, or /. (Note, "-" is not included. To start your expression with a minus, either type
/calc $0 - XYZor/calc + -(XYZ). This is because "-" is also a unary operator and starts a negative number literal.)
Expression Syntax
- Any Lua expression is valid syntax.
- Operators: binary + (addition), - (subtraction), * (multiplication), / (division), % (modulo), and ^ (exponentiation); and unary - (negation)
- Note: using "$n" where n is any positive number will substitute the result of that previous calculation, and "$0" is a shortcut for the most recent result. There is no way to escape this behavior at this moment in time.
Mathematical Functions
math.abs math.acos math.asin math.atan math.atan2 math.ceil math.cos math.deg math.exp math.floor math.log math.log10 math.max math.min math.mod math.pow math.rad math.sin math.sqrt math.tan math.frexp math.ldexp math.random math.randomseed math.sinh math.cosh math.tanh
These functions can all be called from /calc. All trigonometric functions use radians.