From e84f090d03314aa1c2666652784587f80aaca784 Mon Sep 17 00:00:00 2001 From: Lars Mueller Date: Sat, 13 Nov 2021 16:30:23 +0100 Subject: [PATCH] Add table.from_iterator --- table.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/table.lua b/table.lua index 6204669..a4a0154 100644 --- a/table.lua +++ b/table.lua @@ -10,6 +10,14 @@ empty = {} -- Table helpers +function from_iterator(...) + local table = {} + for key, value in ... do + table[key] = value + end + return table +end + function map_index(table, func) local mapping_metatable = { __index = function(table, key)