Asked • 05/02/19

Lua / Lightroom SDK: how to access field text value?

I'm looking at plugins for Adobe Lightroom using their SDK, which is Lua. I'm just trying to understand one of their hello world examples. local LrFunctionContext = import 'LrFunctionContext' local LrBinding = import 'LrBinding' local LrDialogs = import 'LrDialogs' local LrView = import 'LrView' local LrColor = import 'LrColor' local LrLogger = import 'LrLogger' local myLogger = LrLogger( 'libraryLogger' ) MyHWLibraryItem = {} myLogger:enable( "print" ) -- or "logfile" function MyHWLibraryItem.outputToLog( message )  myLogger:trace( message ) end function MyHWLibraryItem.showCustomDialog()  -- body of show-dialog function  LrFunctionContext.callWithContext( "showCustomDialog", function( context )   -- body of called function   local props = LrBinding.makePropertyTable( context ) -- create bound table   props.isChecked = true -- add a property key and initial value   -- create view hierarchy   local f = LrView.osFactory()      -- Create the contents for the dialog.   local c = f:row {     bind_to_object = props,         -- Add a checkbox and an edit_field.       f:checkbox {     title = "Enable",     value = LrView.bind( "isChecked" ),    },    f:edit_field {     value = "Some Text",     enabled = LrView.bind( "isChecked" )    }   }     local result = LrDialogs.presentModalDialog(    {    title = "Custom Dialog",    contents = c, -- the view hierarchy we defined    }   ) --this is where I am trying get the value of the text box   MyHWLibraryItem.outputToLog(c.row.checkbox.title)  end) end MyHWLibraryItem.showCustomDialog()So, what I want to do is send the value of the edit_field dialog box to the console (i.e. in Mac OSX).Questions:1) how to access the text in the dialog box?2) What is going on with the f:checkbox and f:edit_field where there are no () brackets and instead there are {} brackets? Why aren't those functions written like f:edit_field()?

1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.