diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-06-18 21:41:51 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-06-18 21:41:51 +0000 |
commit | cdae8c02ed79efec522408b95106dca028e30ebf (patch) | |
tree | d15ee16ba5e886654863291394dae68b3a0bcc9d | |
parent | 7ed89c97f760600df238f9853ee453570935870f (diff) | |
download | luasocket-cdae8c02ed79efec522408b95106dca028e30ebf.tar.gz luasocket-cdae8c02ed79efec522408b95106dca028e30ebf.tar.bz2 luasocket-cdae8c02ed79efec522408b95106dca028e30ebf.zip |
*** empty log message ***
-rw-r--r-- | doc/index.html | 28 | ||||
-rw-r--r-- | doc/reference.html | 1 | ||||
-rw-r--r-- | doc/socket.html | 48 |
3 files changed, 71 insertions, 6 deletions
diff --git a/doc/index.html b/doc/index.html index b96385e..7394386 100644 --- a/doc/index.html +++ b/doc/index.html | |||
@@ -108,21 +108,41 @@ contains several examples, this user's manual and the test procedures. | |||
108 | </p> | 108 | </p> |
109 | 109 | ||
110 | <p> | 110 | <p> |
111 | I am also providing a Windows binary for those that want to give | 111 | I am also providing PC Win32 binaries for those that want to give |
112 | LuaSocket a quick try: | 112 | LuaSocket a quick try: |
113 | </p> | 113 | </p> |
114 | 114 | ||
115 | <blockquote> | 115 | <blockquote> |
116 | <p> | 116 | <p> |
117 | <a href="luasocket-2.0.exe">luasocket-2.0.exe</a> | 117 | <a href="luasocket-2.0-beta-win32.zip">luasocket-2.0-beta-win32.zip</a> |
118 | </p> | 118 | </p> |
119 | </blockquote> | 119 | </blockquote> |
120 | 120 | ||
121 | <p> | 121 | <p> |
122 | This binary has been compiled with the <tt>LUASOCKET_DEBUG</tt> | 122 | The quick and dirty way to use these binaries is to unpack everything into a |
123 | option, and should be able to run the automatic test procedures. | 123 | directory, say <tt>c:\luasocket</tt> (include all Lua files from the |
124 | LuaSocket distrbitution in the same directory too!). | ||
125 | Then set <tt>LUA_INIT</tt> to load the <tt>lua.lua</tt> helper file: | ||
124 | </p> | 126 | </p> |
125 | 127 | ||
128 | <pre class=example> | ||
129 | c:\luasocket\> set LUA_INIT=@lua.lua | ||
130 | </pre> | ||
131 | |||
132 | <p> | ||
133 | From that directory, you can then run the interpreter and it should find all | ||
134 | files it needs. To download this manual page from the Internet, for example, | ||
135 | do the following: | ||
136 | </p> | ||
137 | |||
138 | <pre class=example> | ||
139 | c:\luasocket\> lua | ||
140 | Lua 5.0.2 Copyright (C) 1994-2004 Tecgraf, PUC-Rio | ||
141 | > http = require"http" | ||
142 | > print(http.request"http://www.tecgraf.puc-rio.br/luasocket/") | ||
143 | --> this file | ||
144 | </pre> | ||
145 | |||
126 | <!-- thanks +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 146 | <!-- thanks +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
127 | 147 | ||
128 | <h2 id=thanks>Special thanks</h2> | 148 | <h2 id=thanks>Special thanks</h2> |
diff --git a/doc/reference.html b/doc/reference.html index f130d7b..ec81d72 100644 --- a/doc/reference.html +++ b/doc/reference.html | |||
@@ -140,6 +140,7 @@ | |||
140 | <blockquote> | 140 | <blockquote> |
141 | <a href="socket.html#debug">DEBUG</a>, | 141 | <a href="socket.html#debug">DEBUG</a>, |
142 | <a href="dns.html#dns">dns</a>, | 142 | <a href="dns.html#dns">dns</a>, |
143 | <a href="socket.html#newtry">newtry</a>, | ||
143 | <a href="socket.html#protect">protect</a>, | 144 | <a href="socket.html#protect">protect</a>, |
144 | <a href="socket.html#select">select</a>, | 145 | <a href="socket.html#select">select</a>, |
145 | <a href="socket.html#sink">sink</a>, | 146 | <a href="socket.html#sink">sink</a>, |
diff --git a/doc/socket.html b/doc/socket.html index 06296a3..4d77478 100644 --- a/doc/socket.html +++ b/doc/socket.html | |||
@@ -60,6 +60,49 @@ This constant is set to <tt><b>true</b></tt> if the library was compiled | |||
60 | with debug support. | 60 | with debug support. |
61 | </p> | 61 | </p> |
62 | 62 | ||
63 | <!-- newtry +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
64 | |||
65 | <p class=name id=newtry> | ||
66 | socket.<b>newtry(</b>finalizer<b>)</b> | ||
67 | </p> | ||
68 | |||
69 | <p class=description> | ||
70 | Creates and returns a <em>clean</em> | ||
71 | <a href="#try"><tt>try</tt></a> | ||
72 | function that allows for cleanup before the exception | ||
73 | is raised. | ||
74 | </p> | ||
75 | |||
76 | <p class=parameters> | ||
77 | <tt>Finalizer</tt> is a function that will be called before | ||
78 | <tt>try</tt> throws the exception. It will be called | ||
79 | in <em>protected</em> mode. | ||
80 | </p> | ||
81 | |||
82 | <p class=return> | ||
83 | The function returns your customized <tt>try</tt> function. | ||
84 | </p> | ||
85 | |||
86 | <p class=note> | ||
87 | Note: This idea saved a <em>lot</em> of work with the | ||
88 | implementation of protocols in LuaSocket: | ||
89 | </p> | ||
90 | |||
91 | <pre class=example> | ||
92 | foo = socket.protect(function() | ||
93 | -- connect somewhere | ||
94 | local c = socket.try(socket.connect("somewhere", 42)) | ||
95 | -- create a try function that closes 'c' on error | ||
96 | local try = socket.newtry(function() c:close() end) | ||
97 | -- do everything reassured c will be closed | ||
98 | try(c:send("helo there?\r\n")) | ||
99 | local answer = try(c:receive()) | ||
100 | ... | ||
101 | try(c:send("good bye\r\n")) | ||
102 | c:close() | ||
103 | end) | ||
104 | </pre> | ||
105 | |||
63 | 106 | ||
64 | <!-- protect +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 107 | <!-- protect +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
65 | 108 | ||
@@ -209,7 +252,7 @@ Freezes the program execution during a given amount of time. | |||
209 | 252 | ||
210 | <p class=parameters> | 253 | <p class=parameters> |
211 | <tt>Time</tt> is the number of seconds to sleep for. | 254 | <tt>Time</tt> is the number of seconds to sleep for. |
212 | The function truncates <tt>time</tt> to the nearest integer. | 255 | The function truncates <tt>time</tt> down to the nearest integer. |
213 | </p> | 256 | </p> |
214 | 257 | ||
215 | <!-- source +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 258 | <!-- source +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
@@ -252,7 +295,8 @@ socket.<b>time()</b> | |||
252 | 295 | ||
253 | <p class=description> | 296 | <p class=description> |
254 | Returns the time in seconds, relative to the origin of the | 297 | Returns the time in seconds, relative to the origin of the |
255 | universe. Only time differences are meaninful. | 298 | universe. You should subtract the values returned by this function |
299 | to get meaningful values. | ||
256 | </p> | 300 | </p> |
257 | 301 | ||
258 | <p class=return> | 302 | <p class=return> |