luasocket/gem/ex6.lua

15 lines
231 B
Lua
Raw Normal View History

2007-10-11 23:16:28 +02:00
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