aboutsummaryrefslogtreecommitdiff
path: root/doc/installation.html
diff options
context:
space:
mode:
authorDiego Nehab <diego.nehab@gmail.com>2012-04-17 01:15:26 +0800
committerDiego Nehab <diego.nehab@gmail.com>2012-04-17 01:15:26 +0800
commitf37e0260261f7691246429d227cf7124c291e8b1 (patch)
tree7e84322c8852d4227e36958af1132a4588f64795 /doc/installation.html
parentb3c4f46179ed5b27ca76a824f8730fa50dbaae0b (diff)
downloadluasocket-f37e0260261f7691246429d227cf7124c291e8b1.tar.gz
luasocket-f37e0260261f7691246429d227cf7124c291e8b1.tar.bz2
luasocket-f37e0260261f7691246429d227cf7124c291e8b1.zip
First stab at documenation
Update Lua and Luasocket version in samples and in documentation Documented ipv5_v6only default option being set Documented tcp6 and udp6 Documented dns.getaddrinfo Documented zero-sized datagram change? Documented getoption
Diffstat (limited to 'doc/installation.html')
-rw-r--r--doc/installation.html78
1 files changed, 24 insertions, 54 deletions
diff --git a/doc/installation.html b/doc/installation.html
index bb9a5bb..00b2db0 100644
--- a/doc/installation.html
+++ b/doc/installation.html
@@ -39,24 +39,16 @@ Installation">
39 39
40<h2>Installation</h2> 40<h2>Installation</h2>
41 41
42<p> LuaSocket 2.0.2 uses the new package system for Lua 5.1. 42<p> LuaSocket 2.1.1-rc still uses Lua&nbsp;5.1's package
43All Lua library developers are encouraged to update their libraries so that 43system. Users that have already made the switch to
44all libraries can coexist peacefully and users can benefit from the 44Lua&nbsp;5.2 should leave the default
45standardization and flexibility of the standard. 45<tt>LUA_COMPAT_MODULE</tt> defined when compiling their Lua
46</p> 46distribution for compatibility with LuaSocket. </p>
47
48<p>
49Those stuck with Lua 5.0 will need the
50<a href=http://www.keplerproject.org/compat/>compat-5.1</a>
51module. It is maintained by
52<a href=http://www.keplerproject.org/>The Kepler
53Project</a>'s team, and implements the Lua 5.1 package proposal
54on top of Lua 5.0. </p>
55 47
56<p> Here we will only describe the standard distribution. 48<p> Here we describe the standard distribution. If the
57If the standard doesn't meet your needs, we refer you to the 49standard doesn't meet your needs, we refer you to the Lua
58Lua discussion list, where any question about the package 50discussion list, where any question about the package scheme
59scheme will likely already have been answered. </p> 51will likely already have been answered. </p>
60 52
61<h3>Directory structure</h3> 53<h3>Directory structure</h3>
62 54
@@ -64,14 +56,19 @@ scheme will likely already have been answered. </p>
64directories, one for system dependent files, and another for system 56directories, one for system dependent files, and another for system
65independent files. Let's call these directories <tt>&lt;CDIR&gt;</tt> 57independent files. Let's call these directories <tt>&lt;CDIR&gt;</tt>
66and <tt>&lt;LDIR&gt;</tt>, respectively. 58and <tt>&lt;LDIR&gt;</tt>, respectively.
67For instance, in my laptop, I use '<tt>/usr/local/lib/lua/5.0</tt>' for 59For example, in my laptp, Lua&nbsp;5.1 is configured to
68<tt>&lt;CDIR&gt;</tt> and '<tt>/usr/local/share/lua/5.0</tt>' for 60use '<tt>/usr/local/lib/lua/5.1</tt>' for
69<tt>&lt;LDIR&gt;</tt>. On Windows, sometimes only one directory is used, say 61<tt>&lt;CDIR&gt;</tt> and '<tt>/usr/local/share/lua/5.1</tt>' for
70'<tt>c:\program files\lua\5.0</tt>'. Here is the standard LuaSocket 62<tt>&lt;LDIR&gt;</tt>. On Windows, <tt>&lt;CDIR&gt;</tt>
63usually points to the directory where the Lua executable is
64found, and <tt>&lt;LDIR&gt;</tt> points to a
65<tt>lua/</tt> directory inside <tt>&lt;CDIR&gt;</tt>. (These
66settings can be overridden by environment variables
67<tt>LUA_PATH</tt> and <tt>LUA_CPATH</tt>. See the Lua
68documentation for details.) Here is the standard LuaSocket
71distribution directory structure:</p> 69distribution directory structure:</p>
72 70
73<pre class=example> 71<pre class=example>
74&lt;LDIR&gt;/compat-5.1.lua
75&lt;LDIR&gt;/ltn12.lua 72&lt;LDIR&gt;/ltn12.lua
76&lt;LDIR&gt;/socket.lua 73&lt;LDIR&gt;/socket.lua
77&lt;CDIR&gt;/socket/core.dll 74&lt;CDIR&gt;/socket/core.dll
@@ -88,33 +85,6 @@ distribution directory structure:</p>
88would be replaced by <tt>core.so</tt>. 85would be replaced by <tt>core.so</tt>.
89</p> 86</p>
90 87
91<p> In order for the interpreter to find all LuaSocket components, three
92environment variables need to be set. The first environment variable tells
93the interpreter to load the <tt>compat-5.1.lua</tt> module at startup: </p>
94
95<pre class=example>
96LUA_INIT=@&lt;LDIR&gt;/compat-5.1.lua
97</pre>
98
99<p>
100This is only need for Lua&nbsp;5.0! Lua&nbsp;5.1 comes with
101the package system built in, of course.
102</p>
103
104<p>
105The other two environment variables instruct the compatibility module to
106look for dynamic libraries and extension modules in the appropriate
107directories and with the appropriate filename extensions.
108</p>
109
110<pre class=example>
111LUA_PATH=&lt;LDIR&gt;/?.lua;?.lua
112LUA_CPATH=&lt;CDIR&gt;/?.dll;?.dll
113</pre>
114
115<p> Again, naturally, on Unix systems the shared library extension would be
116<tt>.so</tt> instead of <tt>.dll</tt>.</p>
117
118<h3>Using LuaSocket</h3> 88<h3>Using LuaSocket</h3>
119 89
120<p> With the above setup, and an interpreter with shared library support, 90<p> With the above setup, and an interpreter with shared library support,
@@ -122,19 +92,19 @@ it should be easy to use LuaSocket. Just fire the interpreter and use the
122<tt>require</tt> function to gain access to whatever module you need:</p> 92<tt>require</tt> function to gain access to whatever module you need:</p>
123 93
124<pre class=example> 94<pre class=example>
125Lua 5.1.2 Copyright (C) 1994-2007 Lua.org, PUC-Rio 95Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
126&gt; socket = require("socket") 96&gt; socket = require("socket")
127&gt; print(socket._VERSION) 97&gt; print(socket._VERSION)
128--&gt; LuaSocket 2.0.2 98--&gt; LuaSocket 2.1.1-rc1
129</pre> 99</pre>
130 100
131<p> Each module loads their dependencies automatically, so you only need to 101<p> Each module loads their dependencies automatically, so you only need to
132load the modules you directly depend upon: </p> 102load the modules you directly depend upon: </p>
133 103
134<pre class=example> 104<pre class=example>
135Lua 5.1.2 Copyright (C) 1994-2007 Lua.org, PUC-Rio 105Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
136&gt; http = require("socket.http") 106&gt; http = require("socket.http")
137&gt; print(http.request("http://www.cs.princeton.edu/~diego/professional/luasocket")) 107&gt; print(http.request("http://www.impa.br/~diego/software/luasocket"))
138--&gt; homepage gets dumped to terminal 108--&gt; homepage gets dumped to terminal
139</pre> 109</pre>
140 110
@@ -153,7 +123,7 @@ Lua 5.1.2 Copyright (C) 1994-2007 Lua.org, PUC-Rio
153<p> 123<p>
154<small> 124<small>
155Last modified by Diego Nehab on <br> 125Last modified by Diego Nehab on <br>
156Thu Apr 20 00:25:30 EDT 2006 126Mon Apr 16 21:01:42 HKT 2012
157</small> 127</small>
158</p> 128</p>
159</center> 129</center>