mirror of
https://github.com/TangentFoxy/lume.git
synced 2024-11-19 07:04:24 +00:00
Changed lume.combine() to ignore nil args
This commit is contained in:
parent
076ca7972c
commit
283f7ee787
10
lume.lua
10
lume.lua
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user