diff options
Diffstat (limited to '')
-rw-r--r-- | docs/installation.html | 70 |
1 files changed, 15 insertions, 55 deletions
diff --git a/docs/installation.html b/docs/installation.html index 25c0bba..b56f50f 100644 --- a/docs/installation.html +++ b/docs/installation.html | |||
@@ -37,70 +37,30 @@ Installation"> | |||
37 | 37 | ||
38 | <!-- installation ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 38 | <!-- installation ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
39 | 39 | ||
40 | <h2>Installation</h2> | 40 | <h2>Installation via luarocks</h2> |
41 | |||
42 | <p> Here we describe the standard distribution. If the | ||
43 | standard doesn't meet your needs, we refer you to the Lua | ||
44 | discussion list, where any question about the package scheme | ||
45 | will likely already have been answered. </p> | ||
46 | |||
47 | <h3>Directory structure</h3> | ||
48 | |||
49 | <p> On Unix systems, the standard distribution uses two base | ||
50 | directories, one for system dependent files, and another for system | ||
51 | independent files. Let's call these directories <tt><CDIR></tt> | ||
52 | and <tt><LDIR></tt>, respectively. | ||
53 | For example, in my laptp, Lua 5.1 is configured to | ||
54 | use '<tt>/usr/local/lib/lua/5.1</tt>' for | ||
55 | <tt><CDIR></tt> and '<tt>/usr/local/share/lua/5.1</tt>' for | ||
56 | <tt><LDIR></tt>. On Windows, <tt><CDIR></tt> | ||
57 | usually points to the directory where the Lua executable is | ||
58 | found, and <tt><LDIR></tt> points to a | ||
59 | <tt>lua/</tt> directory inside <tt><CDIR></tt>. (These | ||
60 | settings can be overridden by environment variables | ||
61 | <tt>LUA_PATH</tt> and <tt>LUA_CPATH</tt>. See the Lua | ||
62 | documentation for details.) Here is the standard LuaSocket | ||
63 | distribution directory structure:</p> | ||
64 | 41 | ||
65 | <pre class=example> | ||
66 | <LDIR>/ltn12.lua | ||
67 | <LDIR>/socket.lua | ||
68 | <CDIR>/socket/core.dll | ||
69 | <LDIR>/socket/http.lua | ||
70 | <LDIR>/socket/tp.lua | ||
71 | <LDIR>/socket/ftp.lua | ||
72 | <LDIR>/socket/smtp.lua | ||
73 | <LDIR>/socket/url.lua | ||
74 | <LDIR>/mime.lua | ||
75 | <CDIR>/mime/core.dll | ||
76 | </pre> | ||
77 | 42 | ||
78 | <p> Naturally, on Unix systems, <tt>core.dll</tt> | ||
79 | would be replaced by <tt>core.so</tt>. | ||
80 | </p> | ||
81 | 43 | ||
82 | <h3>Using LuaSocket</h3> | 44 | <p>LuaSocket can be easily installed using <a href="https://luarocks.org/" target="_blank">LuaRocks</a>, the Lua package manager.</p> |
83 | 45 | ||
84 | <p> With the above setup, and an interpreter with shared library support, | 46 | <h3>Installing via LuaRocks</h3> |
85 | it should be easy to use LuaSocket. Just fire the interpreter and use the | ||
86 | <tt>require</tt> function to gain access to whatever module you need:</p> | ||
87 | 47 | ||
48 | <p>Run the following command in your terminal:</p> | ||
88 | <pre class=example> | 49 | <pre class=example> |
89 | Lua 5.2.2 Copyright (C) 1994-2013 Lua.org, PUC-Rio | 50 | luarocks install luasocket |
90 | > socket = require("socket") | ||
91 | > print(socket._VERSION) | ||
92 | --> LuaSocket 3.1.0 | ||
93 | </pre> | 51 | </pre> |
94 | 52 | ||
95 | <p> Each module loads their dependencies automatically, so you only need to | 53 | <h3>Verification</h3> |
96 | load the modules you directly depend upon: </p> | 54 | <p>To verify that LuaSocket is installed correctly, open Lua and run:</p> |
55 | <pre class=example><code> | ||
56 | local socket = require("socket") | ||
57 | print(socket._VERSION) | ||
58 | </code></pre> | ||
97 | 59 | ||
98 | <pre class=example> | 60 | <p>If you see output like <strong>LuaSocket 3.0</strong>, the installation was successful.</p> |
99 | Lua 5.2.2 Copyright (C) 1994-2013 Lua.org, PUC-Rio | 61 | |
100 | > http = require("socket.http") | 62 | <h3>More Information</h3> |
101 | > print(http.request("http://www.impa.br/~diego/software/luasocket")) | 63 | <p>For more details, visit the <a href="https://github.com/lunarmodules/luasocket" target="_blank">LuaSocket GitHub repository</a>.</p> |
102 | --> homepage gets dumped to terminal | ||
103 | </pre> | ||
104 | 64 | ||
105 | <!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 65 | <!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
106 | 66 | ||