Repository navigation
Union
Dennis Corvers edited this page Oct 23, 2026
·
2 revisions
Returns unique values from the source and a second iterable.
combined = source:union(second, keySelector)| Parameter | Type | Description |
|---|---|---|
second |
iterable | Additional values to include. |
keySelector |
function(value, sourceKey) (optional) |
Selects keys used to remove duplicates. |
A deferred Enumerable containing the first value for each key, enumerating
the source before the second iterable.
Without a selector, each value is used as its key. With a selector, the same
selector is used for both inputs. Selected keys must not be nil.
local party = LuaQ.from({
{ id = 41, name = "Ada" },
{ id = 58, name = "Bryn" },
})
:union({
{ id = 58, name = "Bryn (duplicate)" },
{ id = 73, name = "Cato" },
}, function(player) return player.id end)
:toTable()
-- Keeps one entry per player idUnique · Difference · Intersect · Functions
- 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