Where are the modules installed using luarocks
Asked Answered
R

3

11

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...

Rolling answered 3/7, 2014 at 20:7 Comment(2)
It might be lualogging/init.lua.Venditti
@ColonelThirtyTwo I managed to stumble upon it in /usr/local/share/lua/5.1/lualogging.lua. Thanks for the tip though!Rolling
L
10

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

Leg answered 4/7, 2014 at 18:58 Comment(0)
S
2

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

Spano answered 18/11, 2019 at 10:3 Comment(0)
T
2

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

Thames answered 5/8, 2023 at 5:2 Comment(2)
Not relevant because this doesn't say where the base isLivialivid
@Livialivid Already replenishedCrustal

© 2022 - 2024 — McMap. All rights reserved.