Repository navigation
Intersect
Dennis Corvers edited this page Oct 23, 2026
·
2 revisions
Returns unique values from the source whose selected keys are also found in a second iterable.
common = source:intersect(second, keySelector)| Parameter | Type | Description |
|---|---|---|
second |
iterable | Values to compare against. |
keySelector |
function(value, sourceKey) (optional) |
Selects comparison keys for both inputs. |
A deferred Enumerable containing matching source values, at most once per
key, in source iteration order.
Without a selector, values themselves are used as keys. With a selector, the
same selector is applied to both inputs. Selected keys must not be nil.
local party = LuaQ.from({
{ id = 41, name = "Ada" },
{ id = 58, name = "Bryn" },
{ id = 73, name = "Cato" },
})
:intersect({
{ id = 58, name = "Bryn" },
{ id = 73, name = "Cato" },
}, function(player) return player.id end)
:toTable()
-- Only players also present in the second rosterUnique · Difference · Union · 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