Debian Codegraph @

texk/web2c/luatexdir/luasocket/doc/installation.html

raw symbols SCIP
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: Installation</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="index.html">home</a> &middot;
29 <a href="index.html#download">download</a> &middot;
30 <a href="installation.html">installation</a> &middot;
31 <a href="introduction.html">introduction</a> &middot;
32 <a href="reference.html">reference</a>
33 </p>
34 </center>
35 <hr>
36 </div>
37
38 <!-- installation ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
39
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>
64
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
78 <p> Naturally, on Unix systems, <tt>core.dll</tt>
79 would be replaced by <tt>core.so</tt>.
80 </p>
81
82 <h3>Using LuaSocket</h3>
83
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>
87
88 <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.0-rc1
93 </pre>
94
95 <p> Each module loads their dependencies automatically, so you only need to
96 load the modules you directly depend upon: </p>
97
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>
104
105 <!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
106
107 <div class=footer>
108 <hr>
109 <center>
110 <p class=bar>
111 <a href="index.html">home</a> &middot;
112 <a href="index.html#down">download</a> &middot;
113 <a href="installation.html">installation</a> &middot;
114 <a href="introduction.html">introduction</a> &middot;
115 <a href="reference.html">reference</a>
116 </p>
117 <p>
118 <small>
119 Last modified by Diego Nehab on <br>
120 Tue Jun 11 19:06:14 HKT 2013
121 </small>
122 </p>
123 </center>
124 </div>
125
126 </body>
127 </html>