2 Replies Latest reply on Feb 13, 2015 2:56 AM by ula.uvula

    lua require statement & penlight

    ula.uvula

      Hello community,

      I have written direct with lua some code and here I'm using the penlight library with several classes.

      stevedonovan/Penlight · GitHub

       

      This library is based in a Sub Directory structure and can be loaded with code like

      require ('pl.pretty)     OR

      local pretty = require ('pl.pretty');

      Usage:

      pretty.dump(list);

       

      The "pl" is like a package and the lua script is loaded from the Sub Directory.

       

      If I use this library in my lightroom plugin I will get some error

      "error loading toolkit script could not load"

       

      In the PDF from SDK there are some informations, that "require" is not the original lua implementation. This is a overriden function.

       

      Has somebody any idea, how to use the penlight library. How can I load this library.

       

      Thanks

        • 1. Re: lua require statement & penlight
          johnrellis Most Valuable Participant

          I don't recall anyone posting here about Penlight.  Over the years, people have alluded to the difficulties of using Lua libraries not written for the Lightroom environment.

           

          So I think you'll have to debug this yourself. I suggest starting with the section "Using built-in Lua features" on page 19 of the Lightroom SDK 5 Programmer's Guide, which lists the restrictions LR places on its use of Lua 5.1.4.  (It appears that Penlight claims to support 5.1, but who knows.)

           

          If what you want primarily is pretty printing of Lua data structures, you could use my Debugging Toolkit for Lightroom SDK.  The toolkit is much more limited in scope than Penlight, but it's implemented specifically for LR.

          • 2. Re: lua require statement & penlight
            ula.uvula Level 1

            Thanks.

            OK I see the problem. And the penlight is using unsupported methods.

            So I have to write my own classes.