Comment on page
🔢
math
math.abs(x: number):
number
Name | Type | Description |
---|---|---|
x | number | Number |
Returns the absolute value of x.
math.acos(x: number):
number
Name | Type | Description |
---|---|---|
x | number | Number |
Returns the arc cosine of x (in radians).
math.asin(x: number):
number
Name | Type | Description |
---|---|---|
x | number | Number |
Returns the arc sine of x (in radians).
math.atan(x: number):
number
Name | Type | Description |
---|---|---|
x | number | Number |
Returns the arc tangent of x (in radians).
math.atan2(x: number, y: number):
number
Name | Type | Description |
---|---|---|
x | number | Number |
y | number | Number |
Returns the arc tangent of y/x (in radians), but uses the signs of both parameters to find the quadrant of the result. (It also handles correctly the case of x being zero.)
math.ceil(x: number):
number
Name | Type | Description |
---|---|---|
x | number | Number |
Returns the smallest integer larger than or equal to x.
math.clamp(value: number[, min: number, max: number]):
number
Name | Type | Description |
---|---|---|
value | number | The value to clamp |
min | number | The minimum value |
max | number | The maximum value |
Returns the clamped value.
math.cos(x: number):
number
Name | Type | Description |
---|---|---|
x | number | Number |
Returns the cosine of x (assumed to be in radians).
math.cosh(x: number):
number
Name | Type | Description |
---|---|---|
x | number | Number |
Returns the hyperbolic cosine of x.
math.deg(x: number):
number
Name | Type | Description |
---|---|---|
x | number | Number |
Returns the angle x (given in radians) in degrees.
math.exp(x: number):
number
Name | Type | Description |
---|---|---|
x | number | Number |
Returns the value e power x.
math.floor(x: number):
number
Name | Type | Description |
---|---|---|
x | number | Number |
Returns the largest integer smaller than or equal to x.
math.fmod(x: number, y: number):
number
Name | Type | Description |
---|---|---|
x | number | Number |
y | number | Number |
Returns the remainder of the division of x by y that rounds the quotient towards zero.
math.frexp(x: number):
number
, number
Name | Type | Description |
---|---|---|
x | number | Number |
Returns
m
and e
such that x = m2e
, e
is an integer and the absolute value of m
is in the range [0.5, 1)
(or zero when x
is zero).math.huge
:
number
The value HUGE_VAL, a value larger than or equal to any other numerical value.
math.ldexp(x: number, e: number):
number
Name | Type | Description |
---|---|---|
x | number | Number |
e | number | Number |
Returns
m2e
(e should be an integer).math.log(x: number):
number
Name | Type | Description |
---|---|---|
x | number | Number |
Returns the natural logarithm of x.
math.log10(x: number):
number
Name | Type | Description |
---|---|---|
x | number | Number |
Returns the base-10 logarithm of x.
math.map(value: number, in_from: number, in_to: number, out_from: number, out_to: number[, should_clamp: boolean]):
number
Name | Type | Description |
---|---|---|
value | number | The value to map |
in_from | number | In minimum value |
in_to | number | In maximum value |
out_from | number | Out minimum value |
out_to | number | Out maximum value |
should_clamp | boolean | Clamp In range |
Linearly maps two number ranges and returns the mapped value.
math.max(x: number[, ...]):
number
Name | Type | Description |
---|---|---|
x | number | Number |
... | | Comma-separated numbers to concatenate with x |
Returns the maximum value among its arguments.
math.min(x: number[, ...]):
number
Name | Type | Description |
---|---|---|
x | number | Number |
... | | Comma-separated numbers to concatenate with x |
Returns the minimum value among its arguments.
math.modf(x: number):
number
Name | Type | Description |
---|---|---|
x | number | Number |
Returns two numbers, the integral part of x and the fractional part of x.
math.normalize_yaw(x: number):
number
Name | Type | Description |
---|---|---|
x | number | Number |
Returns the normalized yaw angle value.
math.pi
:
number
The value of pi.
math.pow(x: number, y: number):
number
Name | Type | Description |
---|---|---|
x | number | Number |
y | number | Number |
Returns x^y. (You can also use the expression x^y to compute this value.)
math.rad(x: number):
number
Name | Type | Description |
---|---|---|
x | number | Number |
Returns the angle x (given in degrees) in radians.
math.random([m [, n]]):
number
Name | Type | Description |
---|---|---|
m | number | Number |
n | number | Number |
This function is an interface to the simple pseudo-random generator function rand provided by ANSI C.When called without arguments, returns a uniform pseudo-random real number in the range [0,1). When called with an integer number m, math.random returns a uniform pseudo-random integer in the range [1, m]. When called with two integer numbers m and n, math.random returns a uniform pseudo-random integer in the range [m, n].
math.randomseed(x: number):
number
Name | Type | Description |
---|---|---|
x | number | Number |
Sets x as the "seed" for the pseudo-random generator: equal seeds produce equal sequences of numbers.
math.sin(x: number):
number
Name | Type | Description |
---|---|---|
x | number | Number |
Returns the sine of x (assumed to be in radians).
math.sinh(x: number):
number
Name | Type | Description |
---|---|---|
x | number | Number |
Returns the hyperbolic sine of x.
math.sqrt(x: number):
number
Name | Type | Description |
---|---|---|
x | number | Number |
Returns the square root of x. (You can also use the expression x^0.5 to compute this value.)
math.tan(x: number):
number
Name | Type | Description |
---|---|---|
x | number | Number |
Returns the tangent of x (assumed to be in radians).
math.tanh(x: number):
number
Name | Type | Description |
---|---|---|
x | number | Number |
Returns the hyperbolic tangent of x.
Last modified 1yr ago