Skip to content

Commit 47e5bd7

Browse files
authored
docs: Improve installation instructions, focus on LuaRocks installation (#454)
1 parent 58c7608 commit 47e5bd7

File tree

1 file changed

+15
-55
lines changed

1 file changed

+15
-55
lines changed

docs/installation.html

Lines changed: 15 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -37,70 +37,30 @@
3737

3838
<!-- installation ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
3939

40-
<h2>Installation</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>&lt;CDIR&gt;</tt>
52-
and <tt>&lt;LDIR&gt;</tt>, respectively.
53-
For example, in my laptp, Lua&nbsp;5.1 is configured to
54-
use '<tt>/usr/local/lib/lua/5.1</tt>' for
55-
<tt>&lt;CDIR&gt;</tt> and '<tt>/usr/local/share/lua/5.1</tt>' for
56-
<tt>&lt;LDIR&gt;</tt>. On Windows, <tt>&lt;CDIR&gt;</tt>
57-
usually points to the directory where the Lua executable is
58-
found, and <tt>&lt;LDIR&gt;</tt> points to a
59-
<tt>lua/</tt> directory inside <tt>&lt;CDIR&gt;</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>
40+
<h2>Installation via luarocks</h2>
6441

65-
<pre class=example>
66-
&lt;LDIR&gt;/ltn12.lua
67-
&lt;LDIR&gt;/socket.lua
68-
&lt;CDIR&gt;/socket/core.dll
69-
&lt;LDIR&gt;/socket/http.lua
70-
&lt;LDIR&gt;/socket/tp.lua
71-
&lt;LDIR&gt;/socket/ftp.lua
72-
&lt;LDIR&gt;/socket/smtp.lua
73-
&lt;LDIR&gt;/socket/url.lua
74-
&lt;LDIR&gt;/mime.lua
75-
&lt;CDIR&gt;/mime/core.dll
76-
</pre>
7742

78-
<p> Naturally, on Unix systems, <tt>core.dll</tt>
79-
would be replaced by <tt>core.so</tt>.
80-
</p>
8143

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>
8345

84-
<p> With the above setup, and an interpreter with shared library support,
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>
46+
<h3>Installing via LuaRocks</h3>
8747

48+
<p>Run the following command in your terminal:</p>
8849
<pre class=example>
89-
Lua 5.2.2 Copyright (C) 1994-2013 Lua.org, PUC-Rio
90-
&gt; socket = require("socket")
91-
&gt; print(socket._VERSION)
92-
--&gt; LuaSocket 3.1.0
50+
luarocks install luasocket
9351
</pre>
9452

95-
<p> Each module loads their dependencies automatically, so you only need to
96-
load the modules you directly depend upon: </p>
53+
<h3>Verification</h3>
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>
9759

98-
<pre class=example>
99-
Lua 5.2.2 Copyright (C) 1994-2013 Lua.org, PUC-Rio
100-
&gt; http = require("socket.http")
101-
&gt; print(http.request("http://www.impa.br/~diego/software/luasocket"))
102-
--&gt; homepage gets dumped to terminal
103-
</pre>
60+
<p>If you see output like <strong>LuaSocket 3.0</strong>, the installation was successful.</p>
61+
62+
<h3>More Information</h3>
63+
<p>For more details, visit the <a href="https://github.com/lunarmodules/luasocket" target="_blank">LuaSocket GitHub repository</a>.</p>
10464

10565
<!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
10666

0 commit comments

Comments
 (0)