Repository navigation
Max
Dennis Corvers edited this page Oct 23, 2026
·
1 revision
Returns the maximum value, or the original item whose selected value is maximum.
maximum = values:max(selector)| Parameter | Type | Description |
|---|---|---|
selector |
function(value, sourceKey) (optional) |
Selects the value used for comparison. |
Without a selector, returns the maximum value. With a selector, returns the original value that has the maximum selected value.
The iterable must contain at least one value. Values or selected values must
support Lua's < comparison.
local highestLevelPlayer = LuaQ.from({
{ name = "Ada", level = 92 },
{ name = "Bryn", level = 78 },
{ name = "Cato", level = 99 },
})
:max(function(player) return player.level end)
-- highestLevelPlayer.name is "Cato"- Home
- Getting Started
-
Functions
- aggregate
- all
- any
- concat
- contains
- count
- create
- createFrom
- deepCopy
- difference
- elementAt
- elementAtOrDefault
- first
- firstOrDefault
- flatMap
- foreach
- groupBy
- groupByResult
- indexOf
- intersect
- ipairs
- last
- lastOrDefault
- map
- max
- min
- pairs
- sequenceEquals
- single
- singleOrDefault
- sort
- sortBy
- sortByDescending
- sortDescending
- sum
- take
- takeWhile
- thenBy
- thenByDecending
- toLookup
- toMap
- toSet
- toTable
- union
- unique
- where
- zip
- Aliases