util.math.min
Shared
Returns the smallest value among the given arguments
Syntax
local result = util.math.min(
value,
...
)Parameters
| Type | Name | Description |
|---|---|---|
float | value | First number |
float | ... | Additional numbers to compare |
Returns
| Type | Name | Description |
|---|---|---|
float | result | The smallest of all given values |
Examples
local result = util.math.min(3, 7)
core.engine.print("info", result) -- 3local result = util.math.min(10, 5, 8, 1, 6)
core.engine.print("info", result) -- 1local result = util.math.min(-1, -5, -3)
core.engine.print("info", result) -- -5local result = util.math.min(99)
core.engine.print("info", result) -- 99local speed = 150
local clamped = util.math.min(speed, 100)
core.engine.print("info", clamped) -- 100local value = 120
local clamped = util.math.max(0, util.math.min(value, 100))
core.engine.print("info", clamped) -- 100local item_count = 25
local slot_count = 10
local render_count = util.math.min(item_count, slot_count)
core.engine.print("info", render_count) -- 10