diff options
| author | Diego Nehab <diego.nehab@gmail.com> | 2012-04-17 01:15:26 +0800 |
|---|---|---|
| committer | Diego Nehab <diego.nehab@gmail.com> | 2012-04-17 01:15:26 +0800 |
| commit | f37e0260261f7691246429d227cf7124c291e8b1 (patch) | |
| tree | 7e84322c8852d4227e36958af1132a4588f64795 /doc/installation.html | |
| parent | b3c4f46179ed5b27ca76a824f8730fa50dbaae0b (diff) | |
| download | luasocket-f37e0260261f7691246429d227cf7124c291e8b1.tar.gz luasocket-f37e0260261f7691246429d227cf7124c291e8b1.tar.bz2 luasocket-f37e0260261f7691246429d227cf7124c291e8b1.zip | |
First stab at documenation
Update Lua and Luasocket version in samples and in documentation
Documented ipv5_v6only default option being set
Documented tcp6 and udp6
Documented dns.getaddrinfo
Documented zero-sized datagram change?
Documented getoption
Diffstat (limited to 'doc/installation.html')
| -rw-r--r-- | doc/installation.html | 78 |
1 files changed, 24 insertions, 54 deletions
diff --git a/doc/installation.html b/doc/installation.html index bb9a5bb..00b2db0 100644 --- a/doc/installation.html +++ b/doc/installation.html | |||
| @@ -39,24 +39,16 @@ Installation"> | |||
| 39 | 39 | ||
| 40 | <h2>Installation</h2> | 40 | <h2>Installation</h2> |
| 41 | 41 | ||
| 42 | <p> LuaSocket 2.0.2 uses the new package system for Lua 5.1. | 42 | <p> LuaSocket 2.1.1-rc still uses Lua 5.1's package |
| 43 | All Lua library developers are encouraged to update their libraries so that | 43 | system. Users that have already made the switch to |
| 44 | all libraries can coexist peacefully and users can benefit from the | 44 | Lua 5.2 should leave the default |
| 45 | standardization and flexibility of the standard. | 45 | <tt>LUA_COMPAT_MODULE</tt> defined when compiling their Lua |
| 46 | </p> | 46 | distribution for compatibility with LuaSocket. </p> |
| 47 | |||
| 48 | <p> | ||
| 49 | Those stuck with Lua 5.0 will need the | ||
| 50 | <a href=http://www.keplerproject.org/compat/>compat-5.1</a> | ||
| 51 | module. It is maintained by | ||
| 52 | <a href=http://www.keplerproject.org/>The Kepler | ||
| 53 | Project</a>'s team, and implements the Lua 5.1 package proposal | ||
| 54 | on top of Lua 5.0. </p> | ||
| 55 | 47 | ||
| 56 | <p> Here we will only describe the standard distribution. | 48 | <p> Here we describe the standard distribution. If the |
| 57 | If the standard doesn't meet your needs, we refer you to the | 49 | standard doesn't meet your needs, we refer you to the Lua |
| 58 | Lua discussion list, where any question about the package | 50 | discussion list, where any question about the package scheme |
| 59 | scheme will likely already have been answered. </p> | 51 | will likely already have been answered. </p> |
| 60 | 52 | ||
| 61 | <h3>Directory structure</h3> | 53 | <h3>Directory structure</h3> |
| 62 | 54 | ||
| @@ -64,14 +56,19 @@ scheme will likely already have been answered. </p> | |||
| 64 | directories, one for system dependent files, and another for system | 56 | directories, one for system dependent files, and another for system |
| 65 | independent files. Let's call these directories <tt><CDIR></tt> | 57 | independent files. Let's call these directories <tt><CDIR></tt> |
| 66 | and <tt><LDIR></tt>, respectively. | 58 | and <tt><LDIR></tt>, respectively. |
| 67 | For instance, in my laptop, I use '<tt>/usr/local/lib/lua/5.0</tt>' for | 59 | For example, in my laptp, Lua 5.1 is configured to |
| 68 | <tt><CDIR></tt> and '<tt>/usr/local/share/lua/5.0</tt>' for | 60 | use '<tt>/usr/local/lib/lua/5.1</tt>' for |
| 69 | <tt><LDIR></tt>. On Windows, sometimes only one directory is used, say | 61 | <tt><CDIR></tt> and '<tt>/usr/local/share/lua/5.1</tt>' for |
| 70 | '<tt>c:\program files\lua\5.0</tt>'. Here is the standard LuaSocket | 62 | <tt><LDIR></tt>. On Windows, <tt><CDIR></tt> |
| 63 | usually points to the directory where the Lua executable is | ||
| 64 | found, and <tt><LDIR></tt> points to a | ||
| 65 | <tt>lua/</tt> directory inside <tt><CDIR></tt>. (These | ||
| 66 | settings can be overridden by environment variables | ||
| 67 | <tt>LUA_PATH</tt> and <tt>LUA_CPATH</tt>. See the Lua | ||
| 68 | documentation for details.) Here is the standard LuaSocket | ||
| 71 | distribution directory structure:</p> | 69 | distribution directory structure:</p> |
| 72 | 70 | ||
| 73 | <pre class=example> | 71 | <pre class=example> |
| 74 | <LDIR>/compat-5.1.lua | ||
| 75 | <LDIR>/ltn12.lua | 72 | <LDIR>/ltn12.lua |
| 76 | <LDIR>/socket.lua | 73 | <LDIR>/socket.lua |
| 77 | <CDIR>/socket/core.dll | 74 | <CDIR>/socket/core.dll |
| @@ -88,33 +85,6 @@ distribution directory structure:</p> | |||
| 88 | would be replaced by <tt>core.so</tt>. | 85 | would be replaced by <tt>core.so</tt>. |
| 89 | </p> | 86 | </p> |
| 90 | 87 | ||
| 91 | <p> In order for the interpreter to find all LuaSocket components, three | ||
| 92 | environment variables need to be set. The first environment variable tells | ||
| 93 | the interpreter to load the <tt>compat-5.1.lua</tt> module at startup: </p> | ||
| 94 | |||
| 95 | <pre class=example> | ||
| 96 | LUA_INIT=@<LDIR>/compat-5.1.lua | ||
| 97 | </pre> | ||
| 98 | |||
| 99 | <p> | ||
| 100 | This is only need for Lua 5.0! Lua 5.1 comes with | ||
| 101 | the package system built in, of course. | ||
| 102 | </p> | ||
| 103 | |||
| 104 | <p> | ||
| 105 | The other two environment variables instruct the compatibility module to | ||
| 106 | look for dynamic libraries and extension modules in the appropriate | ||
| 107 | directories and with the appropriate filename extensions. | ||
| 108 | </p> | ||
| 109 | |||
| 110 | <pre class=example> | ||
| 111 | LUA_PATH=<LDIR>/?.lua;?.lua | ||
| 112 | LUA_CPATH=<CDIR>/?.dll;?.dll | ||
| 113 | </pre> | ||
| 114 | |||
| 115 | <p> Again, naturally, on Unix systems the shared library extension would be | ||
| 116 | <tt>.so</tt> instead of <tt>.dll</tt>.</p> | ||
| 117 | |||
| 118 | <h3>Using LuaSocket</h3> | 88 | <h3>Using LuaSocket</h3> |
| 119 | 89 | ||
| 120 | <p> With the above setup, and an interpreter with shared library support, | 90 | <p> With the above setup, and an interpreter with shared library support, |
| @@ -122,19 +92,19 @@ it should be easy to use LuaSocket. Just fire the interpreter and use the | |||
| 122 | <tt>require</tt> function to gain access to whatever module you need:</p> | 92 | <tt>require</tt> function to gain access to whatever module you need:</p> |
| 123 | 93 | ||
| 124 | <pre class=example> | 94 | <pre class=example> |
| 125 | Lua 5.1.2 Copyright (C) 1994-2007 Lua.org, PUC-Rio | 95 | Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio |
| 126 | > socket = require("socket") | 96 | > socket = require("socket") |
| 127 | > print(socket._VERSION) | 97 | > print(socket._VERSION) |
| 128 | --> LuaSocket 2.0.2 | 98 | --> LuaSocket 2.1.1-rc1 |
| 129 | </pre> | 99 | </pre> |
| 130 | 100 | ||
| 131 | <p> Each module loads their dependencies automatically, so you only need to | 101 | <p> Each module loads their dependencies automatically, so you only need to |
| 132 | load the modules you directly depend upon: </p> | 102 | load the modules you directly depend upon: </p> |
| 133 | 103 | ||
| 134 | <pre class=example> | 104 | <pre class=example> |
| 135 | Lua 5.1.2 Copyright (C) 1994-2007 Lua.org, PUC-Rio | 105 | Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio |
| 136 | > http = require("socket.http") | 106 | > http = require("socket.http") |
| 137 | > print(http.request("http://www.cs.princeton.edu/~diego/professional/luasocket")) | 107 | > print(http.request("http://www.impa.br/~diego/software/luasocket")) |
| 138 | --> homepage gets dumped to terminal | 108 | --> homepage gets dumped to terminal |
| 139 | </pre> | 109 | </pre> |
| 140 | 110 | ||
| @@ -153,7 +123,7 @@ Lua 5.1.2 Copyright (C) 1994-2007 Lua.org, PUC-Rio | |||
| 153 | <p> | 123 | <p> |
| 154 | <small> | 124 | <small> |
| 155 | Last modified by Diego Nehab on <br> | 125 | Last modified by Diego Nehab on <br> |
| 156 | Thu Apr 20 00:25:30 EDT 2006 | 126 | Mon Apr 16 21:01:42 HKT 2012 |
| 157 | </small> | 127 | </small> |
| 158 | </p> | 128 | </p> |
| 159 | </center> | 129 | </center> |
