diff options
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 |
