diff --git a/lume.lua b/lume.lua index ca845b6..1c1b742 100644 --- a/lume.lua +++ b/lume.lua @@ -724,7 +724,9 @@ end local ripairs_iter = function(t, i) i = i - 1 local v = t[i] - if v then return i, v end + if v ~= nil then + return i, v + end end function lume.ripairs(t) diff --git a/test/test.lua b/test/test.lua index e81d2c5..25ce17e 100644 --- a/test/test.lua +++ b/test/test.lua @@ -581,12 +581,12 @@ end -- lume.ripairs tests["lume.ripairs"] = function() - local t = { "a", "b", "c" } + local t = { "a", "b", false, "c" } local r = {} for i, v in lume.ripairs(t) do table.insert(r, { i, v }) end - testeq( r, { { 3, "c" }, { 2, "b" }, { 1, "a" } }) + testeq( r, { { 4, "c" }, { 3, false }, { 2, "b" }, { 1, "a" } }) tester.test.error(lume.ripairs, nil) end