0

i have been using lua for torch in command like. where i used luarocks to install packages but now i have a need to debug some code. As suggested by the community "Zerobrane Studio" is a lightweight IDE for that purpose. i have installed it on ubuntu 14.04.

Now i want to install the same packages as the IDE has its own installation of lua. Packages are i.e "dp, dpnn, nn" but after some search i found out ZeroBranes Studio uses luadist package manager. i went onto luadist.org. and tried one of the ways which lets you download the package using lua. i ran this code in the IDE. but it didn't work.

Use LuaDist functionality from Lua.

$ ./lua
> local ld = require "dist"
> ld.install("luaexpat")

Please help!

Qaisar Rajput
  • 751
  • 1
  • 8
  • 21

1 Answers1

2

It should be sufficient in most cases to set the package.path and package.cpath paths in your script to provide access to those modules you are using (whether those modules are from LuaDist, Luarocks or manually installed next to your application scripts).

ZeroBrane Studio provides luadist plugin that simplifies the integration with modules installed from LuaDist and allows management of those modules directly from the Local console in the IDE. This plugin will also set the paths for the script (when running/debugging from the IDE), so you don't need to make any changes to the script itself, but it's likely to work only for the modules installed into that instance of LuaDist.

You may also want to check this post on Lua package managers and their integration with ZeroBrane Studio.

Paul Kulchenko
  • 25,884
  • 3
  • 38
  • 56
  • yes i got that. but the problem is i already have packages installed in luarocks(which by the looks of it doesn't have packages with .lua extensions). on the console i printed package.path and appended the output to the package.path in the script which i ran on the IDE. the option 1 is to download the same libraries with luadist (i don't know how). option 2 is to use the installed packages in luarocks in the IDE (the above experiment didn't work). i must be missing something. – Qaisar Rajput Oct 13 '17 at 17:04
  • You need to show how you "appended the output to the package.path in the script which i ran on the IDE" and what exactly didn't work after you did this. What was the error message? Also, what was the path where the modules were installed by luarocks? – Paul Kulchenko Oct 17 '17 at 05:40
  • sure @Paul . infact i got it right. first i printed the 'package.path' in the terminal (for the env i already have packages installed) copied it. and in the IDE (where new packages are needed) added the line `package.path = package.path .. pathsCopiedAbove`. This showed error for a library called `libpaths`. i presumed the issue was the conflict of two installations. next i made `package.path = pathsCopiedAbove`. still same issue. then i noticed there are some c libraries too. so i did the whole process for `package.cpath` too. it worked – Qaisar Rajput Oct 17 '17 at 06:40