Issues

Issue #146 duplicate

How to "require" a library

rodrigokiller
created an issue

Sorry for this type of "question" (yes, i think that its not an issue) But, i have some libs in "C:\Programming\ZeroBrane Studio\lualibs" that I used in the ZeroBrane "IDE", like

local https = require("ssl.https")

I want to do that 'cause I want to do a POST in a https server (the socket.http dont do that right).

I only can do the require correctly if I import all the files under the lualibs path in the project main directory.

There is some way to the interpreter "see" the C:\Programming\ZeroBrane Studio\lualibs as a ./ ?

Thanks.

Comments (4)

  1. Jon Akhtar repo owner

    Have you tried creating a library in your module that points to that directory?

    I'm not sure that it will solve the problem, but Im just curious if you tried to configure a lua library dependency for your module.

  2. rodrigokiller reporter

    Yes. I tried File > Project Structure (CTRL+ALT+SHIFT+S) In project settings, in Libraries, clicked in the "+" button, "New Lua Library" and selected the folder -> C:\Programming\ZeroBrane Studio\lualibs

    Screen Shot 03-27-14 at 08.57 AM.PNG

    That didnt work.

    I tried to add the files in the C:\Programming\ZeroBrane Studio\lualibs as a new Library (selected all the files).

    Screen Shot 03-27-14 at 08.56 AM.PNG

    Didnt work too.

    Screen Shot 03-27-14 at 09.03 AM.PNG

  3. Jon Akhtar repo owner

    Ok, the plugin's require functionality doesn't really do a proper implementation of require. It doesn't search package.path, it just looks for module() statements.

    I think that is the source of confusion. I never solved this issue. It will take some engineering effort.

  4. Log in to comment