Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing Lua socket library

Either I'm overtired or blind. I want to learn networking with Lua and therefore I have to install the socket lib, so I can require it easily, but I don't know, which files I should "require". The example says:

local socket = require("socket")

but as I said, I don't know which files I should include, if I use socket.lua it doesn't work and I get: No files found.

I got the lib from here: Lua socket download

Or, is there another way to install the socket lib?

like image 559
user1248569 Avatar asked Apr 27 '12 19:04

user1248569


People also ask

What is Lua socket?

LuaSocket is a Lua extension library composed of two parts: a set of C modules that provide support for the TCP and UDP transport layers, and. a set of Lua modules that provide functions commonly needed by applications that deal with the Internet.

How do I install luarocks?

To install Luarocks, you first need to install Lua. On Windows and Mac, you can download and install Lua from the website. Once Lua is installed, install Luarocks. If you're on Linux, the luarocks command is available in your distribution's repository.


1 Answers

use this command on your linux system :

#luarocks install luasocket

the use the next command to see the paths CONFIGURATION

#luarocks 

You need to use default linux account (see: CONFIGURATION) :

$lua 
> socket = require ("socket")

or use this:

> socket = require 'socket'
like image 117
Cătălin George Feștilă Avatar answered Oct 02 '22 20:10

Cătălin George Feștilă