Add table.from_iterator

This commit is contained in:
Lars Mueller 2021-11-13 16:30:23 +01:00
parent e6a71ac13f
commit e84f090d03

@ -10,6 +10,14 @@ empty = {}
-- Table helpers -- Table helpers
function from_iterator(...)
local table = {}
for key, value in ... do
table[key] = value
end
return table
end
function map_index(table, func) function map_index(table, func)
local mapping_metatable = { local mapping_metatable = {
__index = function(table, key) __index = function(table, key)