I want to dynamically add buttons to my extensions dialogue, which when clicked call a function with an argument, so the function can determine which button (or a value/ID) was clicked.
Like this ideally:
at runtime an arbitrary amount of these will be added, the button text and position can be generated at runtime that works..
Code: Select all
d:add_button("Button 1",my_function(1),1,1,1,1)
d:add_button("Button 2",my_function(2),1,2,1,1)
d:add_button("Button 3",my_function(3),1,3,1,1)
BUT it seems the add_button method? it does not support arguments in the parenthesis after the function name, it gives me error:
Code: Select all
my-extension.lua:60: dialog:add_button usage: (text, func)
I just need some way of ID'ing which dynamically created button has been clicked, whether it's with tables, objects, dynamically created functions or anything, there must be a way.
I've been reading for too long and it's gone above my head so I'm hoping someone could help.
If not I guess i'll have to use a list, it's just a shame as dynamically added buttons in a grid otherwise work perfectly for what I'm trying to do (a custom bookmarking system).
Thanks!