async.map
Shared
Calls handler(value, key) for every entry of the table, in pairs order, and gathers the results that are not nil into a list. The handler may pause with async.wait.
table|bool async.map(table list, function handler [, function callback = nil])
Parameters
| Name | Type | Description |
|---|---|---|
| list | table | The table to walk. |
| handler | function | Called with each entry's value and key. |
| callback | function | Called with the list of results once everything is done.default nil |
Returns
Inside an async thread and without callback, the list of results. Otherwise it runs in a new thread and returns true.
Example
async.map(getElementsByType("player"), function(player)
async.yield()
return getPlayerName(player)
end, function(names)
outputDebugString(table.concat(names, ", "))
end)NoteOutside an async thread and without
callback, the results are lost.