aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/reference.html3
-rw-r--r--doc/socket.html66
-rw-r--r--doc/tcp.html28
3 files changed, 84 insertions, 13 deletions
diff --git a/doc/reference.html b/doc/reference.html
index 607958b..f130d7b 100644
--- a/doc/reference.html
+++ b/doc/reference.html
@@ -143,8 +143,9 @@
143<a href="socket.html#protect">protect</a>, 143<a href="socket.html#protect">protect</a>,
144<a href="socket.html#select">select</a>, 144<a href="socket.html#select">select</a>,
145<a href="socket.html#sink">sink</a>, 145<a href="socket.html#sink">sink</a>,
146<a href="socket.html#source">source</a>, 146<a href="socket.html#skip">skip</a>,
147<a href="socket.html#sleep">sleep</a>, 147<a href="socket.html#sleep">sleep</a>,
148<a href="socket.html#source">source</a>,
148<a href="socket.html#time">time</a>, 149<a href="socket.html#time">time</a>,
149<a href="tcp.html#tcp">tcp</a>, 150<a href="tcp.html#tcp">tcp</a>,
150<a href="socket.html#try">try</a>, 151<a href="socket.html#try">try</a>,
diff --git a/doc/socket.html b/doc/socket.html
index d7739f8..06296a3 100644
--- a/doc/socket.html
+++ b/doc/socket.html
@@ -169,6 +169,49 @@ socket, leaving it open when done.
169The function returns a sink with the appropriate behavior. 169The function returns a sink with the appropriate behavior.
170</p> 170</p>
171 171
172<!-- skip ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
173
174<p class=name id=skip>
175socket.<b>skip(</b>d [, ret<sub>1</sub>, ret<sub>2</sub> ... ret<sub>N</sub>]<b>)</b>
176</p>
177
178<p class=description>
179Drops a number of arguments and returns the remaining.
180</p>
181
182<p class=parameters>
183<tt>D</tt> is the number of arguments to drop. <tt>Ret<sub>1</sub></tt> to
184<tt>ret<sub>N</sub></tt> are the arguments.
185</p>
186
187<p class=return>
188The function returns <tt>ret<sub>d+1</sub></tt> to <tt>ret<sub>N</sub></tt>.
189</p>
190
191<p class=note>
192Note: This function is useful to avoid creation of dummy variables:
193</p>
194
195<pre class=example>
196-- get the status code and separator from SMTP server reply
197local code, sep = socket.skip(2, string.find(line, "^(%d%d%d)(.?)"))
198</pre>
199
200<!-- sleep ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
201
202<p class=name id=sleep>
203socket.<b>sleep(</b>time<b>)</b>
204</p>
205
206<p class=description>
207Freezes the program execution during a given amount of time.
208</p>
209
210<p class=parameters>
211<tt>Time</tt> is the number of seconds to sleep for.
212The function truncates <tt>time</tt> to the nearest integer.
213</p>
214
172<!-- source +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 215<!-- source +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
173 216
174<p class=name id=source> 217<p class=name id=source>
@@ -201,6 +244,27 @@ side closes the connection.
201The function returns a source with the appropriate behavior. 244The function returns a source with the appropriate behavior.
202</p> 245</p>
203 246
247<!-- time ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
248
249<p class=name id=time>
250socket.<b>time()</b>
251</p>
252
253<p class=description>
254Returns the time in seconds, relative to the origin of the
255universe. Only time differences are meaninful.
256</p>
257
258<p class=return>
259The function returns the time as a number.
260</p>
261
262<pre class=example>
263t = socket.time()
264-- do stuff
265print(socket.time() - t .. " seconds elapsed")
266</pre>
267
204<!-- try ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 268<!-- try ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
205 269
206<p class=name id=try> 270<p class=name id=try>
@@ -212,7 +276,7 @@ Throws an exception in case of error.
212</p> 276</p>
213 277
214<p class=parameters> 278<p class=parameters>
215<tt>Ret</tt><sub>1</sub> to <tt>ret</tt><sub>N</sub> can be arbitrary 279<tt>Ret<sub>1</sub></tt> to <tt>ret<sub>N</sub></tt> can be arbitrary
216arguments, but are usually the return values of a function call 280arguments, but are usually the return values of a function call
217nested with <tt>try</tt>. 281nested with <tt>try</tt>.
218</p> 282</p>
diff --git a/doc/tcp.html b/doc/tcp.html
index 781ec6f..cd417a5 100644
--- a/doc/tcp.html
+++ b/doc/tcp.html
@@ -277,9 +277,10 @@ the transmission.
277<p class=note> 277<p class=note>
278<b>Important note</b>: This function was changed <em>severely</em>. It used 278<b>Important note</b>: This function was changed <em>severely</em>. It used
279to support multiple patterns (but I have never seen this feature used) and 279to support multiple patterns (but I have never seen this feature used) and
280partial results used to be returned in the same way as successful results. 280now it doesn't anymore. Partial results used to be returned in the same
281This last feature violated the idea that all functions should return 281way as successful results. This last feature violated the idea that all
282<tt><b>nil</b></tt> on error. Thus the change. 282functions should return <tt><b>nil</b></tt> on error. Thus it was changed
283too.
283</p> 284</p>
284 285
285<!-- send +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 286<!-- send +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
@@ -300,20 +301,25 @@ result to LuaSocket instead of passing several independent strings.
300</p> 301</p>
301 302
302<p class=return> 303<p class=return>
303The method returns the number of bytes accepted by the transport layer, 304If successful, the method returns the number of bytes accepted by
304followed by an error code. The error code is <b><tt>nil</tt></b> if the operation 305the transport layer. In case of error, the method returns
305completed with no errors, the string '<tt>closed</tt>' in case 306<b><tt>nil</tt></b>, followed by an error message, followed by the
307partial number of bytes accepted by the transport layer.
308The error message can be '<tt>closed</tt>' in case
306the connection was closed before the transmission was completed or the 309the connection was closed before the transmission was completed or the
307string '<tt>timeout</tt>' in case there was a timeout during the 310string '<tt>timeout</tt>' in case there was a timeout during the
308operation. 311operation.
309</p> 312</p>
310 313
311<p class=note> 314<p class=note>
312Note: The return values for the <tt>send</tt> method have been changed in 315<b>Important note</b>:
313LuaSocket 2.0! In previous versions, the method returned only the 316The return values for the <tt>send</tt> method have been changed in
314error message. Since returning <b><tt>nil</tt></b> in case of success goes 317LuaSocket 2.0 alpha <b>and again</b> in the beta (sorry)!
315against all other LuaSocket methods and functions, the 318In previous versions, the method returned only the
316<tt>send</tt> method been changed for the sake of uniformity. 319error message. Since returning <b><tt>nil</tt></b> in case of success was
320nonsense, in alpha the first return value became the number of bytes sent.
321Alas, it wasn't returning <tt><b>nil</b></tt> in case of
322error. So it was changed again in beta.
317</p> 323</p>
318 324
319<!-- setoption ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 325<!-- setoption ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->