With multiple versions of Lua installed is it possible to specify which one luarock to install to?
Asked Answered
O

2

7

I have both Lua 5.1 and Lua 5.2 installed on Linux. When using luarocks to install a package is it possible to pass on option to luarocks that specifies which version of Lua the rock should be installed for?

Orate answered 21/5, 2015 at 0:15 Comment(0)
N
3

Not a command line option, but you may have different variants of the LuaRocks command line program available (luarocks-5.1 and luarocks-5.2) if you installed LuaRocks for both Lua versions.

You can do so from source using (assuming a Debian/Ubuntu-like lua5.1 executable):

./configure --lua-version=5.1 --lua-suffix=5.1 --versioned-rocks-dir
# make sure that you got the correct Lua executable and include directory
sudo make bootstrap

and the same for Lua 5.2.

In case configure's auto-detection does not find the correct executables/directories, the following flags might be of help:

  • --with-lua-bin=DIR (directory where the Lua executable is installed)
  • --with-lua-include=DIR (directory where the Lua include files are)
  • --with-lua-lib=DIR (you probably don't need this one on Linux)

When you have done that, luarocks-5.1 install some-package installs the given package for Lua 5.1, and luarocks-5.2 install some-package installs that same package for Lua 5.2.

If LuaRocks was installed via a package manager, multiple Lua versions may or may not be supported (e.g. the Debian/Ubuntu package is configured for Lua 5.1 only).

Nottinghamshire answered 21/5, 2015 at 4:42 Comment(0)
E
3

You can use luaver for installing, managing and switching between different versions of lua, luarocks.

To install luaver run:

curl https://raw.githubusercontent.com/dhavalkapil/luaver/master/install.sh -o install.sh && . ./install.sh

Then you can install and use multiple versions of lua as follows:

luaver install 5.3.1 # Installs lua version 5.3.1

luaver install 5.3.0 # Installs lua version 5.3.0

luaver use 5.3.1 # Switches to lua version 5.3.1

See https://dhavalkapil.com/luaver/ for more details.

Evasion answered 1/9, 2016 at 12:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.