Repository navigation
Difference
Dennis Corvers edited this page Oct 23, 2026
·
2 revisions
Returns unique values from the source whose selected keys are not present in a second iterable.
result = source:difference(second, keySelector)| Parameter | Type | Description |
|---|---|---|
second |
iterable | Values whose keys should be excluded. |
keySelector |
function(value, sourceKey) (optional) |
Selects comparison keys for both inputs. |
A deferred Enumerable containing values from the source that are absent from
second, with duplicates removed.
Without a selector, values themselves are compared as Lua table keys. With a
selector, the same selector is applied to both inputs. except is an alias.
Selected keys must not be nil.
local availableTasks = LuaQ.from({
{ id = "repair", title = "Repair armor" },
{ id = "supplies", title = "Restock supplies" },
})
:difference({
{ id = "repair", title = "Already done" },
}, function(task) return task.id end)
:toTable()
-- Keeps only the Restock supplies task- 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