mirror of
https://github.com/lunarmodules/luasocket.git
synced 2024-12-27 12:58:21 +01:00
15 lines
231 B
Lua
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
|