diff options
| author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-11-28 08:17:16 +0000 |
|---|---|---|
| committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-11-28 08:17:16 +0000 |
| commit | 534b0cedf714d4de0a6cf67570e11f232cdccf84 (patch) | |
| tree | 14b26a6a8460e57c9739025eb0e661f64bb78b4f /doc/installation.html | |
| parent | 297b32e828b76ee544c9d4f89f996eda78830cc0 (diff) | |
| download | luasocket-534b0cedf714d4de0a6cf67570e11f232cdccf84.tar.gz luasocket-534b0cedf714d4de0a6cf67570e11f232cdccf84.tar.bz2 luasocket-534b0cedf714d4de0a6cf67570e11f232cdccf84.zip | |
Added new instalation section to the manual.
Diffstat (limited to 'doc/installation.html')
| -rw-r--r-- | doc/installation.html | 149 |
1 files changed, 149 insertions, 0 deletions
diff --git a/doc/installation.html b/doc/installation.html new file mode 100644 index 0000000..d5e82d9 --- /dev/null +++ b/doc/installation.html | |||
| @@ -0,0 +1,149 @@ | |||
| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" | ||
| 2 | "http://www.w3.org/TR/html4/strict.dtd"> | ||
| 3 | <html> | ||
| 4 | |||
| 5 | <head> | ||
| 6 | <meta name="description" content="LuaSocket: Introduction to the core"> | ||
| 7 | <meta name="keywords" content="Lua, LuaSocket, TCP, UDP, Network, Support, | ||
| 8 | Installation"> | ||
| 9 | <title>LuaSocket: Instalation</title> | ||
| 10 | <link rel="stylesheet" href="reference.css" type="text/css"> | ||
| 11 | </head> | ||
| 12 | |||
| 13 | <body> | ||
| 14 | |||
| 15 | <!-- header +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
| 16 | |||
| 17 | <div class=header> | ||
| 18 | <hr> | ||
| 19 | <center> | ||
| 20 | <table summary="LuaSocket logo"> | ||
| 21 | <tr><td align=center><a href="http://www.lua.org"> | ||
| 22 | <img width=128 height=128 border=0 alt="LuaSocket" src="luasocket.png"> | ||
| 23 | </a></td></tr> | ||
| 24 | <tr><td align=center valign=top>Network support for the Lua language | ||
| 25 | </td></tr> | ||
| 26 | </table> | ||
| 27 | <p class=bar> | ||
| 28 | <a href="home.html">home</a> · | ||
| 29 | <a href="home.html#download">download</a> · | ||
| 30 | <a href="instalation.html">instalation</a> · | ||
| 31 | <a href="introduction.html">introduction</a> · | ||
| 32 | <a href="reference.html">reference</a> | ||
| 33 | </p> | ||
| 34 | </center> | ||
| 35 | <hr> | ||
| 36 | </div> | ||
| 37 | |||
| 38 | <!-- instalation ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
| 39 | |||
| 40 | <h2>Instalation</h2> | ||
| 41 | |||
| 42 | <p> LuaSocket 2.0 uses the new package proposal for Lua 5.1, throught the | ||
| 43 | compatibility module <a href=http://www.keplerproject.org/compat/> | ||
| 44 | Compat-5.1</a> released in conjunction with Roberto Ierusalimschy and <a | ||
| 45 | href=http://www.keplerproject.org/">The Kepler project</a>. The proposal | ||
| 46 | was considered important enough by the community to justify early adoption. | ||
| 47 | All Lua library developers are encouraged to change their libraries in | ||
| 48 | preparation for the release of Lua 5.1. </p> | ||
| 49 | |||
| 50 | <p> As far as LuaSocket is concerned, this means that whoever is | ||
| 51 | deploying a solution that uses LuaSocket has a lot of freedom. Here we | ||
| 52 | describe only the standard distribution. If the standard doesn't meet your | ||
| 53 | needs, we refer you to the Lua discussion list, where any quesetion about | ||
| 54 | the package scheme will likely be answered promptly. | ||
| 55 | </p> | ||
| 56 | |||
| 57 | <h3>Directory structure</h3> | ||
| 58 | |||
| 59 | <p> The new package scheme has a root directory for the libraries installed | ||
| 60 | on a given system. Let's call this directory <tt><ROOT></tt>. | ||
| 61 | On my system, this is the <tt>/usr/local/share/lua/5.0</tt> directory. | ||
| 62 | Here is the standard LuaSocket distribution directory structure:</p> | ||
| 63 | |||
| 64 | <pre class=example> | ||
| 65 | <ROOT>/compat-5.1.lua | ||
| 66 | <ROOT>/socket.lua | ||
| 67 | <ROOT>/lsocket.dll | ||
| 68 | <ROOT>/mime.lua | ||
| 69 | <ROOT>/lmime.dll | ||
| 70 | <ROOT>/ltn12.lua | ||
| 71 | <ROOT>/socket/http.lua | ||
| 72 | <ROOT>/socket/tp.lua | ||
| 73 | <ROOT>/socket/ftp.lua | ||
| 74 | <ROOT>/socket/smtp.lua | ||
| 75 | <ROOT>/socket/url.lua | ||
| 76 | </pre> | ||
| 77 | |||
| 78 | <p> Naturally, on Unix systems, <tt>lsocket.dll</tt> and <tt>lmime.dll</tt> | ||
| 79 | would be replaced by <tt>lsocket.so</tt> and <tt>lmime.so</tt>. In Mac OS | ||
| 80 | X, they would be replaced by <tt>lsocket.dylib</tt> and | ||
| 81 | <tt>lmime.dylib</tt>. </p> | ||
| 82 | |||
| 83 | <p> In order for the interpreter to find all LuaSocket components, three | ||
| 84 | environment variables need to be set. The first environment variable tells | ||
| 85 | the interpreter to load the <tt>compat-5.1.lua</tt> module. </p> | ||
| 86 | |||
| 87 | <pre class=example> | ||
| 88 | LUA_INIT=@<ROOT>/compat-5.1.lua | ||
| 89 | </pre> | ||
| 90 | |||
| 91 | The other two environment variables instruct the compatibility module to | ||
| 92 | look for dynamic libraries and modules in the appropriate directories and | ||
| 93 | with the appropriate filename extensions. | ||
| 94 | |||
| 95 | <pre class=example> | ||
| 96 | LUA_PATH=<ROOT>/?.lua;?.lua | ||
| 97 | LUA_CPATH=<ROOT>/?.dll;?.dll | ||
| 98 | </pre> | ||
| 99 | |||
| 100 | <p> Again, naturally, in Unix the shared library extension would be | ||
| 101 | <tt>.so</tt> instead of <tt>.dll</tt> and on Mac OS X they would be | ||
| 102 | <tt>.dylib</tt></p> | ||
| 103 | |||
| 104 | <h3>Using LuaSocket</h3> | ||
| 105 | |||
| 106 | <p> With the above setup, and an interpreter with shared library support, | ||
| 107 | it should be easy to use LuaSocket. Just fire the interpreter and use the | ||
| 108 | <tt>require</tt> function to gain access to whatever module you need:</p> | ||
| 109 | |||
| 110 | <pre class=example> | ||
| 111 | Lua 5.0.2 Copyright (C) 1994-2004 Tecgraf, PUC-Rio | ||
| 112 | > socket = require("socket") | ||
| 113 | > print(socket.VERSION) | ||
| 114 | --> LuaSocket 2.0 (beta3) | ||
| 115 | </pre> | ||
| 116 | |||
| 117 | <p> Each module loads their dependencies automatically, so you only need to | ||
| 118 | load the modues you are directly dependent upon. <p> | ||
| 119 | |||
| 120 | <pre class=example> | ||
| 121 | Lua 5.0.2 Copyright (C) 1994-2004 Tecgraf, PUC-Rio | ||
| 122 | > http = require("socket.http") | ||
| 123 | > print(http.get("http://www.tecgraf.puc-rio.br/luasocket")) | ||
| 124 | --> homepage gets dumped to terminal | ||
| 125 | </pre> | ||
| 126 | |||
| 127 | <!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
| 128 | |||
| 129 | <div class=footer> | ||
| 130 | <hr> | ||
| 131 | <center> | ||
| 132 | <p class=bar> | ||
| 133 | <a href="home.html">home</a> · | ||
| 134 | <a href="home.html#down">download</a> · | ||
| 135 | <a href="instalation.html">instalation</a> · | ||
| 136 | <a href="introduction.html">introduction</a> · | ||
| 137 | <a href="reference.html">reference</a> | ||
| 138 | </p> | ||
| 139 | <p> | ||
| 140 | <small> | ||
| 141 | Last modified by Diego Nehab on <br> | ||
| 142 | Thu Jun 17 02:47:21 EDT 2004 | ||
| 143 | </small> | ||
| 144 | </p> | ||
| 145 | </center> | ||
| 146 | </div> | ||
| 147 | |||
| 148 | </body> | ||
| 149 | </html> | ||
