diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-05-26 04:58:32 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-05-26 04:58:32 +0000 |
commit | bf738a03368b8de9c574d9631f131c5a520acf7b (patch) | |
tree | a65c512ce4601b056417ff7154ebdc254d762054 /src/tp.lua | |
parent | 4b7c2db4b7109bf57abd1b76abf24eba27f51aa1 (diff) | |
download | luasocket-bf738a03368b8de9c574d9631f131c5a520acf7b.tar.gz luasocket-bf738a03368b8de9c574d9631f131c5a520acf7b.tar.bz2 luasocket-bf738a03368b8de9c574d9631f131c5a520acf7b.zip |
Working with in the manual.
Diffstat (limited to 'src/tp.lua')
-rw-r--r-- | src/tp.lua | 10 |
1 files changed, 3 insertions, 7 deletions
@@ -87,13 +87,9 @@ function metat.__index:getcontrol() | |||
87 | return self.control | 87 | return self.control |
88 | end | 88 | end |
89 | 89 | ||
90 | function metat.__index:source(src, instr) | 90 | function metat.__index:source(source, step) |
91 | while true do | 91 | local sink = socket.sink("keep-open", self.control) |
92 | local chunk, err = src() | 92 | return ltn12.pump.all(source, sink, step or ltn12.pump.step) |
93 | if not chunk then return not err, err end | ||
94 | local ret, err = self.control:send(chunk) | ||
95 | if not ret then return nil, err end | ||
96 | end | ||
97 | end | 93 | end |
98 | 94 | ||
99 | -- closes the underlying control | 95 | -- closes the underlying control |