title: How do install libraries for both Lua5.2 and 5.1 using Luarocks?
body: <p>I am writing a small Lua project and using Luarocks to install my 3rd-party dependencies. The default Lua version on my machine is 5.2 and up to this point everything is working just fine.</p>
  
  <p>However, today I have stumbled across a problem that is confusing me. I want to run my program on Lua 5.1 and Luajit to see if it would also work on those versions but I am having a hard time getting Luarocks to download the appropriate versions of the dependencies. As a last resort hack, I have tried to tell Lua5.1 to use the 5.2 libraries that Luarocks installed (by setting the <code>LUA_PATH</code> environment variable to the same value as <code>LUA_PATH_5_2</code>) but unfortunately that is not enough: my project depends on LuaFileSystem, a C-based module, so I'm going to need to have separate versions of it installed for 5.1 and 5.2.</p>
  
  <p>What do I have to do to install both the 5.1 and 5.2 versions of my dependencies? Do I need to pass some parameters to the<code>luarocks install</code> command? Do I need to have multiple instances of Luarocks installed on my machine? One thing that confuses me is that the inside the <code>.luarocks</code> folder things are classified under a 5.2 subfolder (~/.luarocks/share/lua/5.2/), suggesting that maybe there could be a way to install things in a sibling <code>5.1</code> folder but at the same time there is only one <code>bin</code> folder, suggesting that luarocks is only able to handle one version of Lua at a time...</p>