luasocket/gem/ex6.lua
2007-10-11 21:16:28 +00:00

15 lines
231 B
Lua

function source.chain(src, f)
return function()
if not src then
return nil
end
local chunk, err = src()
if not chunk then
src = nil
return f(nil)
else
return f(chunk)
end
end
end