Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Loading native code lua modules

Guest
Mar 16, 2009 Mar 16, 2009
I'm trying to load a C lua module into my Lightroom Plugin. Unfortunately I can't get it to work and keep getting the error:

An internal error occurred
Could not load toolkit script: PluginGUI-OSX

This is an Objective-C code lua library and the error occurs on the following line in my lua script:

require 'PluginGUI-OSX'

I've also tried preceding this with the following, but still I get no luck:

package.path = package.path..";./?/init.lua;./?.so"

Has anyone ever had luck trying this? Or does anyone on the Lightroom team know it to be impossible?

Thanks in advance

Rich
TOPICS
SDK
4.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Mar 16, 2009 Mar 16, 2009
On page 16 of the Lightroom SDK manual, we state that the package namespace from Lua is not available in the Lightroom environment. It is not possible to add third-party native code into Lightroom.

If you'd like, contact me off-list (scouten@adobe.com) and describe what you're trying to do. I'll see if I can think of a way to accomplish what you want by some other means.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 08, 2010 Aug 08, 2010

Hello,

I've got a similar problem. But I don't want to include native code. As in every example plugin I've found, I wanted to extract portions of my code to other scripts (just as FtpUploadTask.lua in FTP example)

But whenever I add the following line to my ExportServiceProvider I get an error:

require 'RhubarbHttpClient'

The error message looks as described in the post above:

Plug-in error log for plug-in at: /Users/krizleebear/Library/Application Support/Adobe/Lightroom/Modules/rhubarb-gallery.lrdevplugin

**** Error 1

An error occurred while attempting to run one of the plug-in’s scripts.
Could not load toolkit script: RhubarbHttpClient

**** Error 2

Could not load the post-processing filter from this plug-in.
Could not load toolkit script: RhubarbHttpClient

When I just put my code from RhubarbHttpClient.lua directly into my ExportServiceProvider, it's working.

The full code can be viewed on google-code:

http://code.google.com/p/rhubarb-gallery/source/browse/#svn/trunk/rhubarb_lightroom_plugin/rhubarb-g...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 08, 2010 Aug 08, 2010

escouten has been "replaced" by Chet Drarvik.

One thing you might try:

add the line:

     return RhubarbHttpClient (and maybe make the variable local, just in case there is some issue with the global namespace).

to the end of the RhubarbHttpClient.lua script, then

instead of using require, try:

     local sts, retVal = pcall( dofile, '{path}/RhubarbHttpClient.lua' )

It "should" do about the same thing, but at least it will get the whole package/require function out of the loop and put nothing but the lua compiler between the calling code and the called code. - might shed some light - dunno...

Rob

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 10, 2010 Aug 10, 2010

thanks for your fast reply!

unfortunately your suggestion didn't help.

I fiddled around a bit more and I found a working solution:

I now use require with round braces ():

     require('RhubarbHttpClient');

and I changed the syntax for the definition of the function to:

     RhubarbHttpClient = {}

     RhubarbHttpClient.uploadImage = function(server, album, authToken, imagePath, timeoutSeconds)

     ...

     ...

     end

I still don't use return -- and now it works when I access the function like this:

     RhubarbHttpClient.uploadImage(server, album, authToken, pathOrMessage, timeoutSeconds)

I can't really tell the difference... should be the same for the LUA interpreter...

Thanks and best regards

Christian

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 10, 2010 Aug 10, 2010

So, were both these changes required?

As you said, I too thought both these things you mentioned were syntactic equivalents. i.e. func( param ) is equivalent to func 'param' when there is only one param, and "tbl.funcName = function" meant exactly the same as "function tbl.funcName".

Personally, I'm just curious. But also, if you could isolate and then submit a more specific bug report it may help the future.

Rob

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 10, 2010 Aug 10, 2010

no they were not.

i can't tell the difference.

in the meantime I also rolled back to the beginning.

so we learned ...

... nothing. too bad.

somehow reminds me of 'burn after reading'

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 10, 2010 Aug 10, 2010

ah. now it's getting more interesting.

I'm in the stage of including another lua script (for the ExportDialogSections) and I get the same error again.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 10, 2010 Aug 10, 2010

"somehow reminds me of 'burn after reading'" - never saw it, but I think I can imagine based on context...

Do keep us posted ;-}

R

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 10, 2010 Aug 10, 2010

I commited the changes to the google code repository at:

http://code.google.com/p/rhubarb-gallery/source/browse/#svn/trunk/rhubarb_lightroom_plugin/rhubarb-gallery.lrdevplugin

i committed it in the stage where it's working, but if you uncomment the following line in RhubarbExportServiceProvider.lua it'll break:

     --require('RhubarbExportDialogSections') --script not working if line is not commented out !!!

And isn't it ironic? The script RhubarbHttpClient that didn't work yesterday works today... perfectly.

By the way - I'm using LR 3 and I'm on Mac OSX (Snow Leopard)

Do you need more information? Should I pack the scripts and provide them as download?

Best regards

Christian

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 10, 2010 Aug 10, 2010

solution:

restarted lightroom.

WHY?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 10, 2010 Aug 10, 2010
LATEST

nothing like a good reboot sometimes... OS has bugs, Lightroom has bugs, your plugin might even have a bug ;-} Some say sunspots are also a factor, but I don't think its been proven...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 10, 2010 Aug 10, 2010

thanks for the update. I can't see anything just skimming that would cause the strange behavior. One thing I did see though, 'content' should be declared local in RhubarbHttpClient.lua

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines