Repository navigation
ToSet
Dennis Corvers edited this page Oct 23, 2026
·
1 revision
Converts an iterable into a Lua table used as a set.
set = values:toSet(keySelector)| Parameter | Type | Description |
|---|---|---|
keySelector |
function(value, sourceKey) (optional) |
Selects the set key for each value. |
A Lua table where each selected key maps to true.
Without a selector, each value is used as a key. Keys must be valid Lua table keys; duplicates collapse into one entry.
local roles = LuaQ.from({
{ name = "Ada", role = "mage" },
{ name = "Bryn", role = "ranger" },
{ name = "Cato", role = "mage" },
})
:toSet(function(player) return player.role end)
-- roles.mage and roles.ranger are true- 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