Expand description
The math module — 10 functions + 2 constants.
| Function | Signature | Description |
|---|---|---|
math.abs | (a: number) -> number | Absolute value |
math.min | (a: number, b: number) -> number | Smaller of two values |
math.max | (a: number, b: number) -> number | Larger of two values |
math.floor | (a: number) -> number | Round down |
math.ceil | (a: number) -> number | Round up |
math.round | (a: number) -> number | Round (0.5 rounds up) |
math.round_to | (a: number, decimals: number) -> number | Round to N decimal places |
math.pow | (base: number, exp: number) -> number | Exponentiation |
math.clamp | (value: number, min: number, max: number) -> number | Clamp to range |
math.sqrt | (a: number) -> number | Square root (trap on negative) |
math.PI | constant number | 3.14159265358979… |
math.E | constant number | 2.71828182845904… |
Structs§
- Math
Module - The
mathstdlib module.