mirror of
https://github.com/TangentFoxy/lume.git
synced 2025-07-27 18:42:20 +00:00
Made lume.reduce check initial value for nil
instead of non-truthy
Fixes #32
This commit is contained in:
4
lume.lua
4
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
|
||||
|
Reference in New Issue
Block a user