Repository navigation
Map
Dennis Corvers edited this page Oct 23, 2026
·
2 revisions
Projects each value of an Enumerable into a new value. map is deferred: the
selector runs as the returned Enumerable is iterated.
projected = source:map(selector)| Parameter | Type | Description |
|---|---|---|
selector |
function(value, position) |
Produces the value to yield. Position is 1-based. |
A new Enumerable containing the selector results. Selector results may be
false, but must not be nil.
select is an alias of map. The selector receives each source value and its
1-based position.
local playerNames = LuaQ.from({
{ name = "Ada", role = "mage" },
{ name = "Bryn", role = "ranger" },
})
:map(function(player) return player.name end)
:toTable()
-- { "Ada", "Bryn" }- 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