From f37e0260261f7691246429d227cf7124c291e8b1 Mon Sep 17 00:00:00 2001 From: Diego Nehab Date: Tue, 17 Apr 2012 01:15:26 +0800 Subject: 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 --- doc/installation.html | 78 ++++++++++++++++----------------------------------- 1 file changed, 24 insertions(+), 54 deletions(-) (limited to 'doc/installation.html') 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">

Installation

-

LuaSocket 2.0.2 uses the new package system for Lua 5.1. -All Lua library developers are encouraged to update their libraries so that -all libraries can coexist peacefully and users can benefit from the -standardization and flexibility of the standard. -

- -

-Those stuck with Lua 5.0 will need the -compat-5.1 -module. It is maintained by -The Kepler -Project's team, and implements the Lua 5.1 package proposal -on top of Lua 5.0.

+

LuaSocket 2.1.1-rc still uses Lua 5.1's package +system. Users that have already made the switch to +Lua 5.2 should leave the default +LUA_COMPAT_MODULE defined when compiling their Lua +distribution for compatibility with LuaSocket.

-

Here we will only describe the standard distribution. -If the standard doesn't meet your needs, we refer you to the -Lua discussion list, where any question about the package -scheme will likely already have been answered.

+

Here we describe the standard distribution. If the +standard doesn't meet your needs, we refer you to the Lua +discussion list, where any question about the package scheme +will likely already have been answered.

Directory structure

@@ -64,14 +56,19 @@ scheme will likely already have been answered.

directories, one for system dependent files, and another for system independent files. Let's call these directories <CDIR> and <LDIR>, respectively. -For instance, in my laptop, I use '/usr/local/lib/lua/5.0' for -<CDIR> and '/usr/local/share/lua/5.0' for -<LDIR>. On Windows, sometimes only one directory is used, say -'c:\program files\lua\5.0'. Here is the standard LuaSocket +For example, in my laptp, Lua 5.1 is configured to +use '/usr/local/lib/lua/5.1' for +<CDIR> and '/usr/local/share/lua/5.1' for +<LDIR>. On Windows, <CDIR> +usually points to the directory where the Lua executable is +found, and <LDIR> points to a +lua/ directory inside <CDIR>. (These +settings can be overridden by environment variables +LUA_PATH and LUA_CPATH. See the Lua +documentation for details.) Here is the standard LuaSocket distribution directory structure:

-<LDIR>/compat-5.1.lua
 <LDIR>/ltn12.lua
 <LDIR>/socket.lua
 <CDIR>/socket/core.dll
@@ -88,33 +85,6 @@ distribution directory structure:

would be replaced by core.so.

-

In order for the interpreter to find all LuaSocket components, three -environment variables need to be set. The first environment variable tells -the interpreter to load the compat-5.1.lua module at startup:

- -
-LUA_INIT=@<LDIR>/compat-5.1.lua
-
- -

-This is only need for Lua 5.0! Lua 5.1 comes with -the package system built in, of course. -

- -

-The other two environment variables instruct the compatibility module to -look for dynamic libraries and extension modules in the appropriate -directories and with the appropriate filename extensions. -

- -
-LUA_PATH=<LDIR>/?.lua;?.lua
-LUA_CPATH=<CDIR>/?.dll;?.dll
-
- -

Again, naturally, on Unix systems the shared library extension would be -.so instead of .dll.

-

Using LuaSocket

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 require function to gain access to whatever module you need:

-Lua 5.1.2  Copyright (C) 1994-2007 Lua.org, PUC-Rio
+Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
 > socket = require("socket")
 > print(socket._VERSION)
---> LuaSocket 2.0.2
+--> LuaSocket 2.1.1-rc1
 

Each module loads their dependencies automatically, so you only need to load the modules you directly depend upon:

-Lua 5.1.2  Copyright (C) 1994-2007 Lua.org, PUC-Rio
+Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
 > http = require("socket.http")
-> print(http.request("http://www.cs.princeton.edu/~diego/professional/luasocket"))
+> print(http.request("http://www.impa.br/~diego/software/luasocket"))
 --> homepage gets dumped to terminal
 
@@ -153,7 +123,7 @@ Lua 5.1.2 Copyright (C) 1994-2007 Lua.org, PUC-Rio

Last modified by Diego Nehab on
-Thu Apr 20 00:25:30 EDT 2006 +Mon Apr 16 21:01:42 HKT 2012

-- cgit v1.2.3-55-g6feb