So, you followed the installation instructions (either on Unix or Windows) and now you have LuaRocks installed in your machine. Now you probably want to install some rocks (packages containing Lua modules) and use them in your Lua code.
For LuaRocks to function properly, we have a quick checklist to go through first:
Command-line tools (and the system path)
LuaRocks installs some command-line tools which are your interface for managing your rocks: luarocks and luarocks-admin. Make sure the directory where they are located is in your PATH -- the exact location depends on the flags you gave when installing LuaRocks.
Run luarocks to see the available commands:
luarocks
You can get help on any command by using the help command:
luarocks help install
Installing packages is done by typing commands such as:
luarocks install luasocket
The LuaRocks module loader (and the Lua libraries path)
In order to use Lua modules packed as rocks, you'll need to use the LuaRocks module loader, which overloads the require() function. To do this, the lua/ directory where the LuaRocks sources are located needs to be in your Lua modules lookup path. Again, the exact location depends on your installation flags, and how to set up the Lua modules path depends on your Lua interpreter and your application: you can use the LUA_PATH environment variable, or update the value of the package.path variable from Lua code.
If you installed the Lua interpreter bundled with LuaRocks on Windows, or if you built both Lua and LuaRocks on Unix with the default paths, the default library path settings will be already appropriate.
You should be able to launch the Lua interpreter with the LuaRocks-enabled require by typing:
lua -lluarocks.require
Alternatively, you can load the LuaRocks module loader from Lua by issuing this command:
require "luarocks.require"
If your system is correctly set up so that this command runs with no errors, subsequent calls to require() are LuaRocks-aware. You should be able then to load modules that were installed previously using the luarocks command-line tool.
Scripts installed by rocks (and the scripts path)
Besides modules, rocks can also install command-line scripts. The internal structure of the local rocks repository keeps each rock self-contained, but LuaRocks provides also an "index directory" for command-line scripts, so that they are available from the command prompt by adding a single directory to your system path. The default location of this directory (unless you configured your local repository differently) is ~/.luarocks/bin on Unix and %APPDATA%/luarocks/bin on Windows -- make sure it is in your PATH as well.