map(table, function)

Pass each key/value pair in a table to a function. The function should return a new key/value pair or null. The map function will return a table containing all of the results from the function.

Example

function swap(key,value) return value, key end
t = map({5,4,3,2,1}, swap)