Repository navigation
Count
Dennis Corvers edited this page Oct 23, 2026
·
1 revision
Returns the number of values in an iterable, optionally counting only values accepted by a predicate.
number = values:count(predicate)| Parameter | Type | Description |
|---|---|---|
predicate |
function(value, sourceKey) (optional) |
Returns true to include the value in the count. |
An integer count. Without a predicate, counts all values; with a predicate,
counts only calls that return exactly true.
length, lengthBy, and countBy are aliases. The predicate receives the
source iterator key.
local readyCount = LuaQ.from({
{ name = "Ada", ready = true },
{ name = "Bryn", ready = false },
{ name = "Cato", ready = true },
})
:count(function(player) return player.ready end)
-- 2- 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