Changed lume.combine() to ignore nil args

This commit is contained in:
rxi 2014-04-28 12:46:58 +01:00
parent 076ca7972c
commit 283f7ee787

View File

@ -275,8 +275,14 @@ end
function lume.combine(...) function lume.combine(...)
local funcs = {...} local funcs = {}
assert(lume.all(funcs, iscallable), "expected all arguments to be functions") for i = 1, select("#", ...) do
local fn = select(i, ...)
if fn ~= nil then
assert(iscallable(fn), "expected a function or nil")
funcs[#funcs + 1] = fn
end
end
return function(...) return function(...)
for _, f in ipairs(funcs) do f(...) end for _, f in ipairs(funcs) do f(...) end
end end