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...
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.
LuaRocks is the package manager for Lua modules. LuaRocks is free software and uses the same license as Lua.
if you already have a Lua installation, the single binary package which you can use: get the latest windows-32. zip file here, unpack it and you'll have a luarocks.exe ready to use. Make sure the executable is available from your executable PATH so you can run luarocks from the command line the same way you run lua.
Run luarocks show lualogging
. It will list all modules and where they are.
It should be
require "logging"
not
require "lualogging"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With