Skip to content
Dennis Corvers edited this page Oct 23, 2026 · 1 revision

Enumerable:min

Returns the minimum value, or the original item whose selected value is minimum.

Syntax

minimum = values:min(selector)

Parameters

Parameter Type Description
selector function(value, sourceKey) (optional) Selects the value used for comparison.

Returns

Without a selector, returns the minimum value. With a selector, returns the original value that has the minimum selected value.

Remarks

The iterable must contain at least one value. Values or selected values must support Lua's > comparison.

Example

local lowestSupply = LuaQ.from({
    { name = "Ada", food = 12 },
    { name = "Bryn", food = 3 },
    { name = "Cato", food = 7 },
})
    :min(function(player) return player.food end)
-- lowestSupply.name is "Bryn"

See also

Max · Sum · Functions

Clone this wiki locally