From b1ca160751794272ffcba556297c9117232901bf Mon Sep 17 00:00:00 2001 From: Lars Mueller Date: Sat, 13 Nov 2021 16:34:49 +0100 Subject: [PATCH] Add table.ivalues --- table.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/table.lua b/table.lua index a4a0154..b5c6165 100644 --- a/table.lua +++ b/table.lua @@ -558,6 +558,14 @@ function unique(table) return keys(set(table)) end +function ivalues(table) + local index = 0 + return function() + index = index + 1 + return table[index] + end +end + function rpairs(table) local index = #table return function()