Reputation:
I am using lua 5.1
in a linux system.I installed the luasocket 2.0.2
using this manual.But when i execute the below code of the file test.lua
socket = require("socket")
print(socket._VERSION)
I get the following errors :
lua: ./usr/local/share/lua/5.1/socket.lua:14: loop or previous error loading module 'socket'
stack traceback:
[C]: in function 'require'
./usr/local/share/lua/5.1/socket.lua:14: in main chunk
[C]: in function 'require'
test.lua:1: in main chunk
[C]: ?
But i have included the environmental variable as below:
LUA_PATH=/usr/local/share/lua/5.1/?.lua;?.lua
LUA_CPATH=/usr/local/lib/lua/5.1/?.so;?.so
Upvotes: 4
Views: 3004
Reputation: 26744
You usually get this error when you have a loop in your require
calls, for example, when you do require "socket"
and from that module you do require "socket"
again, before the first require
call is finished.
Check line 14 in socket.lua
file. It should probably have something like local socket = require("socket.core")
(and not require("socket")
). To check if the issue is with loading socket.core
, try executing require "socket.core"
in your own script as it may give you a better error message.
Upvotes: 2