dynamic popup_menu
I have search this forum and found some relating questions, but it does not help me.
I have a text file that contains multiple lines:
{ title = "Nikon F80s", value = "NF80" },
{ title = "Nikon ZF II", value = "NZFII" },I read the file into a variable:
for line in io.lines(file) do
lines[#lines + 1] = line
endthen in my function:
cameraContent = {}
local cameraFile = _PLUGIN.path .. '/lists/cameraList.txt'
local cameraContent = lines_from(cameraFile)
---
....
LrFunctionContext.callWithContext ("CreateDir", function (context)
local f = LrView.osFactory ()
local properties = LrBinding.makePropertyTable (context)
-- Default values for boxes
properties.scanDir = "yesScanDir"
-- Present dialogbox
local result = LrDialogs.presentModalDialog {
...
f:popup_menu {
items = cameraContent ,
value = bind 'myCamera' ,
}, The popup menu is still filled with each full line from the textfile.
The use of load loadstring does not help and gives an error - bad argument #1 to '?' (string expected, got table)
