Try moving the declaration of 'combobox' below those of the 'check_button' widgets.
-- August Schwerdfeger aug...@schwerdfeger.name On Feb 25, 2017 5:11 AM, "Holger Klemm" <darkta...@multimedia4linux.de> wrote: > Hello, > I need your help to correct my lua script. > I have a darktable lua script with which I want to control via a combobox > the > check button. > > The demo script below works but generates the following error: > demo.lua:34: attempt to index global 'check_button1' (a nil value) > stack traceback: > [C]: in function '__newindex' > > > I have tried everything, but no script without error message. > > What am I doing wrong? > Can someone give me an example how to control the check button via the > combo > box without error message? > > Many Thanks > Holger > > > > > local dt = require "darktable" > > dt.configuration.check_version(...,{4,0,0}) > > local combobox = dt.new_widget("combobox") > { > label = "Combobox", > value = 1, "Button 1 is checked", "Button 1 and 2 is checked", > "Nothing > is checked", > > changed_callback = function(selection) > if (selection.value == "Button 1 is checked") then > check_button1.value = true > check_button2.value = false > elseif (selection.value == "Button 1 and 2 is checked") then > check_button1.value = true > check_button2.value = true > elseif (selection.value == "Nothing is checked") then > check_button1.value = false > check_button2.value = false > end > end > } > > > check_button1 = dt.new_widget("check_button") > { > label = "Button 1", > value = true > } > > check_button2 = dt.new_widget("check_button") > { > label = "Button 2", > value = false > } > > > dt.register_lib( > "demo", -- Module name > "demo", -- name > true, -- expandable > false, -- resetable > {[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_RIGHT_CENTER", > 100}}, > -- containers > dt.new_widget("box") -- widget > { > orientation = "vertical", > combobox, > check_button1, > check_button2, > }, > nil, > nil > ) > ____________________________________________________________ > _______________ > darktable developer mailing list > to unsubscribe send a mail to darktable-dev+unsubscribe@ > lists.darktable.org ___________________________________________________________________________ darktable developer mailing list to unsubscribe send a mail to darktable-dev+unsubscr...@lists.darktable.org