From 886bd43bcec547d32bd3c5ca6662864f3394fb0b Mon Sep 17 00:00:00 2001 From: rxi Date: Tue, 24 Feb 2015 20:42:44 +0000 Subject: [PATCH] Changed getiter() to disallow `nil` values --- lume.lua | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lume.lua b/lume.lua index 5b15dd2..99e4550 100644 --- a/lume.lua +++ b/lume.lua @@ -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,9 +326,11 @@ function lume.concat(...) local rtn = {} for i = 1, select("#", ...) do local t = select(i, ...) - local iter = getiter(t) - for k, v in iter(t) do - rtn[#rtn + 1] = v + if t ~= nil then + local iter = getiter(t) + for k, v in iter(t) do + rtn[#rtn + 1] = v + end end end return rtn