Lua / Lightroom SDK: как получить доступ к текстовому значению поля
Я смотрю на плагины для Adobe Lightroom, используя их SDK, то есть Lua. Я просто пытаюсь понять один из их примеров Привет.
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()
Итак, я хочу отправить значение диалогового окна edit_field на консоль (т.е. в Mac OSX).
Вопросы: 1) как получить доступ к тексту в диалоговом окне?
2) Что происходит с флажком f: и полем f:edit_field, где нет скобок () и вместо них {}? Почему эти функции не написаны как f:edit_field()?