Skip to main content

Math

Abs​

math.abs

Absolute value of a number

InTypeWhat it is
Valueany numberA number
OutTypeWhat it is
Resultany numberThe number without its sign

Add​

math.add

Adds two numbers; whole numbers give a whole number, any decimal a decimal

InTypeWhat it is
Firstany numberThe first number
Secondany numberThe second number
OutTypeWhat it is
Resultany numberThe outcome, a whole number when both numbers are whole

Ceil​

math.ceil

Rounds up to the next integer

InTypeWhat it is
ValueNumberA number
OutTypeWhat it is
ResultIntegerRounds up to the next integer

Clamp​

math.clamp

Keeps a number within a lower and upper bound

InTypeWhat it is
Valueany numberThe number to keep in bounds
Lowerany numberThe smallest allowed value
Upperany numberThe largest allowed value
OutTypeWhat it is
Resultany numberThe number, moved into the bounds when outside

Divide​

math.divide

Divides the first number by the second; whole numbers round toward zero and give 0 when dividing by zero

InTypeWhat it is
Firstany numberThe number divided
Secondany numberThe number divided by
OutTypeWhat it is
Resultany numberThe quotient; whole numbers round toward zero

Floor​

math.floor

Rounds down to the next integer

InTypeWhat it is
ValueNumberA number
OutTypeWhat it is
ResultIntegerRounds down to the next integer

Modulo Integer​

math.modulo_integer

The remainder of dividing the first integer by the second, with the second's sign; 0 when dividing by zero

InTypeWhat it is
FirstIntegerThe integer divided
SecondIntegerThe integer divided by
OutTypeWhat it is
ResultIntegerThe remainder

Multiply​

math.multiply

Multiplies two numbers; whole numbers give a whole number, any decimal a decimal

InTypeWhat it is
Firstany numberThe first number
Secondany numberThe second number
OutTypeWhat it is
Resultany numberThe outcome, a whole number when both numbers are whole

Round​

math.round

Rounds to the closest integer

InTypeWhat it is
ValueNumberA number
OutTypeWhat it is
ResultIntegerRounds to the closest integer

Subtract​

math.subtract

Subtracts the second number from the first; whole numbers give a whole number, any decimal a decimal

InTypeWhat it is
Firstany numberThe first number
Secondany numberThe second number
OutTypeWhat it is
Resultany numberThe outcome, a whole number when both numbers are whole