almel
almel

Reputation: 7938

Where are the modules installed using luarocks

I am trying to require a module I downloaded using luarocks using

require "lualogging"

but lua (and I!) cannot find where this module was downloaded to. Here is what I did

I have used apt-get to install luarocks, and then I ran

sudo luarocks install lualogging

I then ran

luarocks list

and received the following output

Installed rocks:

lualogging
1.3.0-1 (installed) - /usr/local/lib/luarocks/rocks

luasocket
3.0rc1-1 (installed) - /usr/local/lib/luarocks/rocks

Natural this led me to believe that lualogging was located in /usr/local/lib/luarocks/rocks, but running this command

find /usr/local/lib/luarocks/rocks "lualogging.lua"

returned nothing. What am I doing wrong here? This may be related, but I cannot find what my LUA_PATH environment variable is so it may be that it was never set? I'd like to be able to run require "lualogging" from any file regardless of where it is located in the filesystem, and then log to my heart's content. But I can't even find where lualogging.lua exists...

Upvotes: 11

Views: 10688

Answers (3)

无数_wushu
无数_wushu

Reputation: 29

You can refer to the one provided by luarocks: rock tree

This document gives the directory structure of luarocks. However, the location of the base directory is not mentioned.

The location of the base directory is not the same on different systems and under different conditions. On Unix/Linux/MacOS it is /usr/local by default, but there is a special case, I don't know if it is a bug or intentional by luarocks, so please refer to this issue:Inconsistent behaviour when executing luarocks in different directories

Upvotes: 2

Max
Max

Reputation: 171

It should be require "logging" not require "lualogging"

Upvotes: 2

Hisham H M
Hisham H M

Reputation: 6798

Run luarocks show lualogging. It will list all modules and where they are.

Upvotes: 10

Related Questions