Copy link to clipboard
Copied
I have a couple of lua scripts (in the scripts folder) making my daily life with Lightroom Classic easier.
This works great, even in the current version 13.4
Today I started to write a new script and realized, that if there is a syntax error, the script simply does nothing.
In previous versions of Lightroom I got a message box telling me what's wrong, but with 13.4 nothing happens.
Assume the following script:
note the syntax error in the first line
lo cal LrDialogs = import 'LrDialogs'
local LrApplication = import 'LrApplication'
local catalog = LrApplication.activeCatalog()
local LrTasks = import 'LrTasks'
LrTasks.startAsyncTask( function()
local targetPhoto = catalog:getTargetPhoto()
local photoId = targetPhoto.localIdentifier
LrDialogs.message("PhotoIDs", "photoId: " .. tostring(photoId))
end)
This buggy script does not produce a syntax error.
Can anyone confirm this?
Thanks
Jacques
Copy link to clipboard
Copied
LR usually silently discards syntax errors. I tested your script with these versions on Mac OS 14.4 -- 13.4, 13.0, 12.0, 11.0 -- and none produced an error when invoked from the Scripts menu.
And LR still silently discards runtime errors in many contexts. For example, this version will alert the user to an internal error:
local cal LrDialogs = import 'LrDialogs'
local LrApplication = import 'LrApplication'
local catalog = LrApplication.activeCatalog()
local LrTasks = import 'LrTasks'
--error ("Darn it!")
LrTasks.startAsyncTask( function()
error ("Darn it!")
local targetPhoto = catalog:getTargetPhoto()
local photoId = targetPhoto.localIdentifier
LrDialogs.message("PhotoIDs", "photoId: " .. tostring(photoId))
end)
but uncommenting the first error() won't alert the user.