libs/nixio: allow calls to nixio.util.consume() with no iterator given

This commit is contained in:
Jo-Philipp Wich 2009-07-18 21:58:41 +00:00
parent 4bc6b85bb7
commit 6abba61632

View file

@ -28,9 +28,11 @@ local ZBUG = uname.sysname == "Linux" and uname.release:sub(1, 3) == "2.4"
function consume(iter, append) function consume(iter, append)
local tbl = append or {} local tbl = append or {}
if iter then
for obj in iter do for obj in iter do
tbl[#tbl+1] = obj tbl[#tbl+1] = obj
end end
end
return tbl return tbl
end end