aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorSharad Singh <144345260+sharadxsingh@users.noreply.github.com>2025-03-31 16:06:12 +0530
committerGitHub <noreply@github.com>2025-03-31 13:36:12 +0300
commit47e5bd71a95a0a36ef5b02e5bf3af3fcab7a4409 (patch)
tree019013efcde1c32f5e9da072807db595240ddc1f /doc
parent58c76080a0c654de906de9f554e2de45b1784929 (diff)
downloadluasocket-master.tar.gz
luasocket-master.tar.bz2
luasocket-master.zip
docs: Improve installation instructions, focus on LuaRocks installation (#454)HEADmaster
Diffstat (limited to '')
-rw-r--r--docs/installation.html70
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
43standard doesn't meet your needs, we refer you to the Lua
44discussion list, where any question about the package scheme
45will likely already have been answered. </p>
46
47<h3>Directory structure</h3>
48
49<p> On Unix systems, the standard distribution uses two base
50directories, one for system dependent files, and another for system
51independent files. Let's call these directories <tt>&lt;CDIR&gt;</tt>
52and <tt>&lt;LDIR&gt;</tt>, respectively.
53For example, in my laptp, Lua&nbsp;5.1 is configured to
54use '<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>
57usually points to the directory where the Lua executable is
58found, and <tt>&lt;LDIR&gt;</tt> points to a
59<tt>lua/</tt> directory inside <tt>&lt;CDIR&gt;</tt>. (These
60settings can be overridden by environment variables
61<tt>LUA_PATH</tt> and <tt>LUA_CPATH</tt>. See the Lua
62documentation for details.) Here is the standard LuaSocket
63distribution directory structure:</p>
64 41
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>
77 42
78<p> Naturally, on Unix systems, <tt>core.dll</tt>
79would 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>
85it 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>
89Lua 5.2.2 Copyright (C) 1994-2013 Lua.org, PUC-Rio 50luarocks install luasocket
90&gt; socket = require("socket")
91&gt; print(socket._VERSION)
92--&gt; 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>
96load 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>
99Lua 5.2.2 Copyright (C) 1994-2013 Lua.org, PUC-Rio 61
100&gt; http = require("socket.http") 62<h3>More Information</h3>
101&gt; 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--&gt; homepage gets dumped to terminal
103</pre>
104 64
105<!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 65<!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
106 66