How can I install multiple versions of Lua on a Linux system (and have them work well with Luarocks)?
Asked Answered
V

2

6

I want to install both Lua 5.2 and 5.1 on my Linux computer. Is this just a matter of installing each version with the usual make linux install or is there something else? In particular, I am worried about the header and library files, since those seem to go on directories that are not namespaced with the version number, such as /usr/local/include.

In addition to that, is it possible to set up Luarocks so that it can install both 5.1 and 5.2 libraries? I know that Luarocks namespaces things in a 5.2 or 5.1 directory, and setting LUA_PATH_5_X and LUA_CPATH_5_X variables should work for configuring Lua after that but I don't understand how Luarocks decides what version of Lua to compile the C libraries against.

Viceroy answered 13/1, 2013 at 16:57 Comment(0)
U
5

You can use luaver for installing, managing and switching between different versions of lua. It is a very easy to use program.

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.

Unmistakable answered 1/9, 2016 at 12:56 Comment(0)
M
1

If you want to use make linux install but create a namespace, edit Makefile and change INSTALL_TOP and other variables accordingly.

Mccarthyism answered 13/1, 2013 at 17:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.