7

I come from a python background and I'm hoping to do something semantically equivalent to pip install -r requirements.txt to install a list of Python packages at the right version.

Is this achievable with luarocks? If not, is there a way to hack this together on the command line?

jpaugh
  • 6,634
  • 4
  • 38
  • 90
Louis Thibault
  • 20,240
  • 25
  • 83
  • 152

2 Answers2

3

The system in Lua is a little different. There is a rockspec manifest file associated with every package. You can list your package dependencies here in this file and you can install then using

"luarocks install name.rockspec".

For more details, visit Luarocks

More on Rockspec format here

Instruction for creating a package/rock here

Community
  • 1
  • 1
rnikhil275
  • 376
  • 2
  • 12
1

In case you just want to install a list of dependencies from a file without worrying about Rockspec, you can also just use this three lines that read a file with the exact same format of a requirements.txt file for pip (package==version):

while read -r line ; do
    luarocks install $(echo $line | awk -F '==' '{print $1, $2}') 
done < lua_requirements.txt
Miguel
  • 2,130
  • 1
  • 11
  • 26