lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I am running Lua 5.3 on OpenSuse Tumbleweed system. I am trying to use Lua as a scripting language in the context of HAProxy webserver. I have Lua installed which, doing `lua -v` at terminal shows Lua 5.3.4.

The problem I have is when I try to run a specific Lua script, auth-request.lua. The first line of code there tries to import http from socket.http:

    local http = require("socket.http")

When I attempt to start HAProxy, i get the following error:

    module socket.http is not found

I installed luasocket using luarocks and the error was not resolved.

I have tried the following since then:

1. Added the location of *.so files from /usr/lib64/lua/5.3/ by defining them as absolute paths in the LUA_PATH environment variable. I added all *.lua files from /usr/share/lua/5.3/ to LUA_CPATH. I checked if the current shell has those values declared by restarting the shell and using echo to print out the paths. This did not solve the problem.

2. After reading about lua require function and how it uses patterns for file names, I tried using /usr/lib64/lua/5.3/?.so for LUA_PATH and /usr/share/lua/5.3/?.lua for LUA_CPATH. This did not solve the problem.

3. Lastly, I added the following lines on auth-request.lua:

     package.path = "/usr/lib64/lua/5.3/?.so"
     package.cpath = "/usr/share/lua/5.3/?.lua"

This did not solve the problem either.


Some help will be greatly appreciated