Skip to content

Namespaces

Hisham Muhammad edited this page Apr 3, 2018 · 3 revisions

Since LuaRocks 3, this concept of per-user versions of a rock has been integrated into the tool, in the form of namespaces.

What you can do with namespaces:

  • Install packages using a namespace:
    • luarocks install my_user/my_rock
  • Depend on a specific namespaced version of a rock in your rockspec:
    • dependencies = { "my_user/my_rock > 2.0" }

Background

LuaRocks has always supported multiple repositories, which can be set in the config file with the rocks_servers entry. A repository is an address (a local directory or a remote URL) where LuaRocks can find a manifest-5.x file and .rock and .rockspec files. We also call such repository a "manifest", for short.

The LuaRocks.org website features a root manifest at https://luarocks.org as well as per-user manifests at https://luarocks.org/manifests/<your-user-name>. Entries in the root manifest are operated in a first-come first-served manner, but even if someone else has already taken a rock name, you can upload your own version of it to your user manifest. You can refer to a per-user manifest the same way as any other rocks server, adding to your configuration or using it with the --server flag. This means that you were aways able to install your own version of a rock using a command such as luarocks install <my-rock> --server=https://luarocks.org/manifests/<your-user-name>.

Clone this wiki locally