libs/nixio: allow calls to nixio.util.consume() with no iterator given
This commit is contained in:
parent
4bc6b85bb7
commit
6abba61632
1 changed files with 4 additions and 2 deletions
|
@ -28,8 +28,10 @@ local ZBUG = uname.sysname == "Linux" and uname.release:sub(1, 3) == "2.4"
|
|||
|
||||
function consume(iter, append)
|
||||
local tbl = append or {}
|
||||
for obj in iter do
|
||||
tbl[#tbl+1] = obj
|
||||
if iter then
|
||||
for obj in iter do
|
||||
tbl[#tbl+1] = obj
|
||||
end
|
||||
end
|
||||
return tbl
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue