math
vec3
vec3(x: number = 0, y: number = 0, z: number = 0)
-> vec3
Creates a new vec3 instance.
Parameters
Name | Type | Description |
---|---|---|
x |
number | X value (defaults to 0 ) |
y |
number | Y value (defaults to 0 ) |
z |
number | Z value (defaults to 0 ) |
Usage
vec = math.vec3(1); -- x = 1, y = 0, z = 0
vec = math.vec3(5, 0, 1); -- x = 5, y = 0, z = 1
clamp
clamp(val: number, min: number, max: number)
-> number
Clamps a number within the given boundaries.
Parameters
Name | Type | Description |
---|---|---|
val |
number | Target value |
min |
number | Minimal value |
max |
number | Maximal value |
Usage
local clamped = math.clamp(100, 25, 75); -- will return 75