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(...)
|
||||
local funcs = {...}
|
||||
assert(lume.all(funcs, iscallable), "expected all arguments to be functions")
|
||||
local funcs = {}
|
||||
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(...)
|
||||
for _, f in ipairs(funcs) do f(...) end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user