aboutsummaryrefslogtreecommitdiff
path: root/src/tp.lua
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2004-05-26 04:58:32 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2004-05-26 04:58:32 +0000
commitbf738a03368b8de9c574d9631f131c5a520acf7b (patch)
treea65c512ce4601b056417ff7154ebdc254d762054 /src/tp.lua
parent4b7c2db4b7109bf57abd1b76abf24eba27f51aa1 (diff)
downloadluasocket-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.lua10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/tp.lua b/src/tp.lua
index e9e38a1..4f2a615 100644
--- a/src/tp.lua
+++ b/src/tp.lua
@@ -87,13 +87,9 @@ function metat.__index:getcontrol()
87 return self.control 87 return self.control
88end 88end
89 89
90function metat.__index:source(src, instr) 90function 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
97end 93end
98 94
99-- closes the underlying control 95-- closes the underlying control