From 47e5bd71a95a0a36ef5b02e5bf3af3fcab7a4409 Mon Sep 17 00:00:00 2001 From: Sharad Singh <144345260+sharadxsingh@users.noreply.github.com> Date: Mon, 31 Mar 2025 16:06:12 +0530 Subject: docs: Improve installation instructions, focus on LuaRocks installation (#454) --- docs/installation.html | 70 +++++++++++--------------------------------------- 1 file changed, 15 insertions(+), 55 deletions(-) (limited to 'docs') 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"> -

Installation

- -

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

- -

On Unix systems, the standard distribution uses two base -directories, one for system dependent files, and another for system -independent files. Let's call these directories <CDIR> -and <LDIR>, respectively. -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:

+

Installation via luarocks

-
-<LDIR>/ltn12.lua
-<LDIR>/socket.lua
-<CDIR>/socket/core.dll
-<LDIR>/socket/http.lua
-<LDIR>/socket/tp.lua
-<LDIR>/socket/ftp.lua
-<LDIR>/socket/smtp.lua
-<LDIR>/socket/url.lua
-<LDIR>/mime.lua
-<CDIR>/mime/core.dll
-
-

Naturally, on Unix systems, core.dll -would be replaced by core.so. -

-

Using LuaSocket

+

LuaSocket can be easily installed using LuaRocks, the Lua package manager.

-

With the above setup, and an interpreter with shared library support, -it should be easy to use LuaSocket. Just fire the interpreter and use the -require function to gain access to whatever module you need:

+

Installing via LuaRocks

+

Run the following command in your terminal:

-Lua 5.2.2  Copyright (C) 1994-2013 Lua.org, PUC-Rio
-> socket = require("socket")
-> print(socket._VERSION)
---> LuaSocket 3.1.0
+luarocks install luasocket
 
-

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

+

Verification

+

To verify that LuaSocket is installed correctly, open Lua and run:

+

+   local socket = require("socket")
+   print(socket._VERSION)
+    
-
-Lua 5.2.2  Copyright (C) 1994-2013 Lua.org, PUC-Rio
-> http = require("socket.http")
-> print(http.request("http://www.impa.br/~diego/software/luasocket"))
---> homepage gets dumped to terminal
-
+

If you see output like LuaSocket 3.0, the installation was successful.

+ +

More Information

+

For more details, visit the LuaSocket GitHub repository.

-- cgit v1.2.3-55-g6feb