richard_henley_3294204's profile

51 Messages

 • 

754 Points

Sat, Jun 22, 2013 7:01 PM

Lightroom SDK: Getting Started Tutorial Documentation Example Code Fails

I defy anyone to simply copy and paste the sample code documented in 'CHAPTER 9: Getting Started: A Tutorial Example', 'Displaying a custom dialog' section into the 'LibraryMenuItem.lua' file AND have it work without correcting it.

There are easily 2 errors in this section of the document:

1) value = “Some Text”,

Should read instead: value = "Some Text",

2) contents = c, -- the view hierarchy we defined

Should read instead:

contents = c -- the view hierarchy we defined

IN ADDITION to NOT properly documenting where specifically the

'local result = LrDialogs.presentModalDialog( ...) }'

code snippet goes within the lua file being constructed.

I can only assume that the rest of this SDK documentation is equally as poor.

I hope someone can point me to a better source of documentation for the SDK.

Responses

Champion

 • 

6K Messages

 • 

103.6K Points

8 y ago

The examples in Chapter 9 are also in the SDK folder Sample Plugins. The helloworld.lrdevplugin folder contains the sample plugin you're referring to. I just tried it in LR 5, and it works. In that folder, what the SDK Guide calls LibraryMenuItem.lua is called ShowCustomDialog.lua.

With regard to:

1) value = “Some Text”,

Looks like the tech writer forgot to turn off "smart quotes".

With regard to:

2) contents = c, -- the view hierarchy we defined

I'm not sure why you think that doesn't work? Lua table syntax allows a trailing comma, e.g. {a = 1, b = 2,} is exactly the same as {a = 1, b = 2}.

In general, I found the SDK documentation acceptable but far from great. The SDK hasn't gotten much love from Adobe since LR 3, in my opinion.

A good place to post questions about the SDK is:

http://forums.adobe.com/community/lig...

Several of us are active there and try to help out the (small) SDK community.

51 Messages

 • 

754 Points

8 y ago

Because the ',' in #2 implies additional code to follow when there is none. It generates an error when it is there in LR4 and the code fails to execute properly for me, possibly it works for you.

I didn't report this as a bug against properly constructed sample code that is NOT referenced by this section of the tutorial documentation.

I logged this against the actual written documentation in this section of the tutorial because it is incorrect. And using it as documented causes the code to fail. And that to me in a example tutorial exercise is NOT acceptable.

IF someone is slowly working through the tutorial BECAUSE they know next to nothing about the SDK how can one possibly construct a clear question when the documentation is incorrect and misleading? It is not as if there is a clear debug strategy available in the software to locate the precise problem encountered.

Champion

 • 

6K Messages

 • 

103.6K Points

8 y ago

I don't want to diminish your general feedback on the SDK documentation, but it's important to clarify the issue with comma so others aren't misled in the future.

You wrote, "the ',' in #2 implies additional code to follow when there is none. It generates an error when it is there in LR4 and the code fails to execute properly for me, possibly it works for you."

Without seeing the entire code in question, I don't know what your actual error is. But the error would not be caused by the trailing comma. As I mentioned, that is valid Lua syntax, and it is a common coding convention among many Lua programmers to use comma as a terminator rather than a separator (much as programmers in many languages use ";" as a terminator rather than a separator between statements).

For example, if you look at Sample Plugins]helloworld.lrdevplugin\Info.lua, you'll see that comma terminates every item in the arrays LrExportMenuItems and LrLibraryMenuItems.