Skip to main content
March 16, 2009
Question

Loading native code lua modules

  • March 16, 2009
  • 2 replies
  • 4179 views
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
This topic has been closed for replies.

2 replies

Participating Frequently
August 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

Participating Frequently
August 10, 2010

solution:

restarted lightroom.

WHY?

areohbee
Braniac
August 10, 2010

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...

escouten
Adobe Employee
Adobe Employee
March 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.
Participating Frequently
August 8, 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-gallery.lrdevplugin

areohbee
Braniac
August 9, 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