3 Replies Latest reply: Mar 25, 2012 4:15 PM by areohbee RSS

    Using startAsyncTask and getting a return value




      I'm just starting to try and learn LUA and the whole Lightroom SDK.  Here is a sample of my code:


      local lrApplication = import 'LrApplication'

      local LrTasks = import 'LrTasks'


      local activeCatalog = lrApplication.activeCatalog()

      local currentPhotos = activeCatalog:getMultipleSelectedOrAllPhotos()

      local y = LrTasks.startAsyncTask(function() return currentPhotos[1]:getFormattedMetadata('fileName') end)


      wheneven I check or try to use y it is nil.


      Please someone tell me the stupid thing I'm doing wrong so I don't lose any more of my dwindling hair. 


      I know that currentPhotos has 5 photos in it's collections because later on I do this:

           for i, onePhoto in ipairs(currentPhotos) do

      and it loops through 5 times, which matches up to the number of photos in the folder I have selected in Lightroom.