Tested each sample.

This commit is contained in:
Diego Nehab 2007-10-11 21:16:28 +00:00
parent e394956cde
commit 52ac60af81
27 changed files with 789 additions and 163 deletions

17
gem/ex10.lua Normal file
View file

@ -0,0 +1,17 @@
function pump.step(src, snk)
local chunk, src_err = src()
local ret, snk_err = snk(chunk, src_err)
if chunk and ret then return 1
else return nil, src_err or snk_err end
end
function pump.all(src, snk, step)
step = step or pump.step
while true do
local ret, err = step(src, snk)
if not ret then
if err then return nil, err
else return 1 end
end
end
end