Firstly, I'm on Debian 11, and am planning to build LuaJIT from source, just like I did for lua5.4.
I would advise against that in your case. As I told you, debian has it, and has the multiversion problem solved. I would take a look at how they do it ( not going to install it, but I suspect it is via update-alternatives or a similar stuff ).
If you could guide me through linking into $PATH and all that would be awesome.
In my case I just compile and copy it to ~/bin, which I prepend to $PATH, to have it handy for tests, as my projects normally use a user home dir as a mini-jail. If you want multiversion, just compiling and copying to a lua-A.B and symlinking as lua will do the trick. Lua is very easy, just a single executable, ldd it for details.
But if you want it for the main program, you will probably be better served by a system install via package manager along a luarocks install on the same route. As I find lua inadequate ( that's my point of view, bear in mind I've been programming for more than four decades and already knew a lot of alternative languages before learning lua, which I use where I think it shines, embedding ) for these kind of things I never use it this way, but if I were to use it I would certainly go for the system install. ( I've revised my tree and noticed I have a lua system install, I did install luacheck via package manager which pulled its dependencies, lua5.1, but I treat it as any other dependency. )
Also, yes I'm planning on using LuaRocks for stuff like moonscript and Lapis, does thay complicate things?
Well, for what I saw they are more complex than lua, but lua is so simple to install that this does not say much. I just did not bother to look at them as the only things external I use are two one-file modules plus another two-file one which I just copy and check into VC ( along the full lua tree used in the project ).
I would start with a system install and familiarize myself with that. In fact I started that way, just without the luarocks steps in the 5.2 days when checking whether to use lua or not ( I had already checked it int the 4.x, 5.0, 5.1 days but did not like it enough until 5.2 ). Not to put you off, but IMNSHO if you do not see putting lua into $PATH as trivial, a do it myself with luarocks may be a PITA, I've seem lots of people suffer with this things.
Francisco Olarte.