無名関数もある。

function map(func, table)
ret = {}
for k,v in pairs(table) do
ret[k] = func(v)
end
return ret
end

tbl = map(function(x) return x*2; end, {3,7})

assert_equal(6, tbl[1])
assert_equal(14, tbl[2])