Skip to main content
Participant
January 8, 2011
Question

Advice using getChildCollectionSets

  • January 8, 2011
  • 1 reply
  • 667 views

Hi All -- I'm a newbie to the LR SDK and Lua and was hoping for a little advice using catalog:getChildCollectionSets.

First off, is there an easy way to get the length of the array returned? I know I can loop thru a For statement and also see that table:getn is not supported. Just wondering if there was an easier way.

Next - any advice or sample code calling this in LrTasks async statement. I was able to set this up and access the getChildCollectionSets returned array within the async loop, but not sure how to access it outside since it is async and timing/scope (i.e., testing when the async call is finished). A small snippet of code would be appreciated.

Thanks....Randy

This topic has been closed for replies.

1 reply

areohbee
Legend
January 8, 2011

Hi Randy,

1. local cs = catalog:getChildCollectionSets( ... )

    if #cs > 2 then...

i.e. use the pound/tic-tac-toe prefix operator to get the length of the array - standard lua stuff...

I would recommend putting the code that uses the collection sets variable in the same task as the one that assigns it a value, so you dont have any "timing" problems.

Participant
January 10, 2011

Thanks Rob for the tips. I'm finding Lua to be somewhat fun although the case-sensitivity still catches me once in a while.

areohbee
Legend
January 11, 2011

I like case insensitive filesystems but case sensitive programming languages.

Have fun with Lua! - Just remember the colon vs. the dot...

Rob