Login
or
register
LuaRocks
Versioned Components For Lua
Overview
Home Page
Mailing list
Browse rocks
Links
Download
Download
Installing on Unix
Installing on Windows
Release history
License
Documentation
Documentation
File formats
Development
Feedback
Using LuaRocks
Anonymous users must enter
captcha
below.
Page Parameters
Page Name (for URL)
Page Title
Show Advanced Options
Category
Don't put anything here
Prototype
Don't put anything here
Don't put anything here
Don't put anything here
Page Content
So, you followed the installation instructions (either on [[Installation instructions for Unix|Unix]] or [[Installation instructions for Windows|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 Lua libraries path ==== To use modules installed with LuaRocks, all you need to do is make sure they are found by Lua's module loading mechanism. 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 and LUA_CPATH environment variables, or update the value of the <code>package.path</code> and <code>package.cpath</code> variables 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. ==== Multiple versions using the LuaRocks package loader === If you want to make use of LuaRocks' support for multiple installed versions of modules, you need to load a custom package loader: luarocks.loader. You should be able to launch the Lua interpreter with the LuaRocks-enabled loader by typing: lua -lluarocks.loader Alternatively, you can load the LuaRocks module loader from Lua by issuing this command: require "luarocks.loader" If your system is correctly set up so that this command runs with no errors, subsequent calls to <code>require()</code> are LuaRocks-aware and the exact version of each module will be determined based on the dependency tree of previously loaded modules. ==== Scripts installed by rocks (and the scripts path) ==== Besides modules, rocks can also install command-line scripts. The default location of this directory (unless you configured your local repository differently) is /usr/local/bin for system-wide installs and ~/.luarocks/bin for per-user installs on Unix and %APPDATA%/luarocks/bin on Windows -- make sure it is in your PATH as well. ==== Using in Unix systems with sudo ==== When you use LuaRocks to install a package while you aren't root, the package will get installed in $HOME/.luarocks/ instead of the system-wide (by default, /usr/local/) and become only available for you. Moreover Lua doesn't know with its default setup that packages can be available in the current user's home. If you want to install a package available for all users, you should run it as superuser, typically using sudo. For example: sudo luarocks install stdlib After that, some files may not have correct permissions. For example, if /usr/local/share/lua/5.1/base.lua is only readable by root user, you should at least set them to readable for all users (chmod a+r or chmod 644). For example: cd /usr/local/share/lua/5.1 sudo chmod a+r *
Don't put anything here
Don't put anything here
About this Edit
Minor Edit
Edit Summary
Powered by
Sputnik
|
XHTML 1.1