*** empty log message ***

This commit is contained in:
Diego Nehab 2004-06-18 21:41:51 +00:00
parent 7ed89c97f7
commit cdae8c02ed
3 changed files with 71 additions and 6 deletions

View File

@ -108,21 +108,41 @@ contains several examples, this user's manual and the test procedures.
</p>
<p>
I am also providing a Windows binary for those that want to give
I am also providing PC Win32 binaries for those that want to give
LuaSocket a quick try:
</p>
<blockquote>
<p>
<a href="luasocket-2.0.exe">luasocket-2.0.exe</a>
<a href="luasocket-2.0-beta-win32.zip">luasocket-2.0-beta-win32.zip</a>
</p>
</blockquote>
<p>
This binary has been compiled with the <tt>LUASOCKET_DEBUG</tt>
option, and should be able to run the automatic test procedures.
The quick and dirty way to use these binaries is to unpack everything into a
directory, say <tt>c:\luasocket</tt> (include all Lua files from the
LuaSocket distrbitution in the same directory too!).
Then set <tt>LUA_INIT</tt> to load the <tt>lua.lua</tt> helper file:
</p>
<pre class=example>
c:\luasocket\&gt; set LUA_INIT=@lua.lua
</pre>
<p>
From that directory, you can then run the interpreter and it should find all
files it needs. To download this manual page from the Internet, for example,
do the following:
</p>
<pre class=example>
c:\luasocket\&gt; lua
Lua 5.0.2 Copyright (C) 1994-2004 Tecgraf, PUC-Rio
&gt; http = require"http"
&gt; print(http.request"http://www.tecgraf.puc-rio.br/luasocket/")
--&gt; this file
</pre>
<!-- thanks +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<h2 id=thanks>Special thanks</h2>

View File

@ -140,6 +140,7 @@
<blockquote>
<a href="socket.html#debug">DEBUG</a>,
<a href="dns.html#dns">dns</a>,
<a href="socket.html#newtry">newtry</a>,
<a href="socket.html#protect">protect</a>,
<a href="socket.html#select">select</a>,
<a href="socket.html#sink">sink</a>,

View File

@ -60,6 +60,49 @@ This constant is set to <tt><b>true</b></tt> if the library was compiled
with debug support.
</p>
<!-- newtry +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<p class=name id=newtry>
socket.<b>newtry(</b>finalizer<b>)</b>
</p>
<p class=description>
Creates and returns a <em>clean</em>
<a href="#try"><tt>try</tt></a>
function that allows for cleanup before the exception
is raised.
</p>
<p class=parameters>
<tt>Finalizer</tt> is a function that will be called before
<tt>try</tt> throws the exception. It will be called
in <em>protected</em> mode.
</p>
<p class=return>
The function returns your customized <tt>try</tt> function.
</p>
<p class=note>
Note: This idea saved a <em>lot</em> of work with the
implementation of protocols in LuaSocket:
</p>
<pre class=example>
foo = socket.protect(function()
-- connect somewhere
local c = socket.try(socket.connect("somewhere", 42))
-- create a try function that closes 'c' on error
local try = socket.newtry(function() c:close() end)
-- do everything reassured c will be closed
try(c:send("helo there?\r\n"))
local answer = try(c:receive())
...
try(c:send("good bye\r\n"))
c:close()
end)
</pre>
<!-- protect +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
@ -209,7 +252,7 @@ Freezes the program execution during a given amount of time.
<p class=parameters>
<tt>Time</tt> is the number of seconds to sleep for.
The function truncates <tt>time</tt> to the nearest integer.
The function truncates <tt>time</tt> down to the nearest integer.
</p>
<!-- source +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
@ -252,7 +295,8 @@ socket.<b>time()</b>
<p class=description>
Returns the time in seconds, relative to the origin of the
universe. Only time differences are meaninful.
universe. You should subtract the values returned by this function
to get meaningful values.
</p>
<p class=return>