From 6389f859c65a0d0ec966d5ebac41f5f52fbb3345 Mon Sep 17 00:00:00 2001 From: rxi Date: Wed, 12 Feb 2020 21:09:33 +0000 Subject: [PATCH] Made lume.reduce check initial value for `nil` instead of `non-truthy` Fixes #32 --- lume.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lume.lua b/lume.lua index 83650e0..0ffc738 100644 --- a/lume.lua +++ b/lume.lua @@ -286,8 +286,8 @@ end function lume.reduce(t, fn, first) + local started = first ~= nil local acc = first - local started = first and true or false local iter = getiter(t) for _, v in iter(t) do if started then @@ -724,7 +724,7 @@ end local ripairs_iter = function(t, i) i = i - 1 local v = t[i] - if v ~= nil then + if v ~= nil then return i, v end end