Changed getiter() to disallow nil values

This commit is contained in:
rxi 2015-02-24 20:42:44 +00:00
parent 976f813de9
commit 886bd43bce

View File

@ -51,13 +51,12 @@ local iternil = function()
end
local getiter = function(x)
if x == nil then
return iternil
elseif isarray(x) then
if isarray(x) then
return ipairs
else
elseif type(x) == "table" then
return pairs
end
error("expected table", 3)
end
local iteratee = function(x)
@ -327,11 +326,13 @@ function lume.concat(...)
local rtn = {}
for i = 1, select("#", ...) do
local t = select(i, ...)
if t ~= nil then
local iter = getiter(t)
for k, v in iter(t) do
rtn[#rtn + 1] = v
end
end
end
return rtn
end