I have made a table of buttons that looks like this:
local t = {"one", "two", "three"} local buttons = {} for i = 1, #t do buttons[#buttons+1] = widget.newButton { id = #buttons, label = t[i], height = 70, width = 70, onRelease = btnHandle } buttons[i].x = (i\*30) + (i\*50) buttons[i].y = 300 end
In my btnHandle function for when it is released, how do I call specific buttons to do different functions? Example: If the first button is pressed, it should print “correct” but the second and third button should print “wrong”.
I can get it to print if a button was pressed at all, but cannot figure out how to differentiate between which button was pressed. Would it just be easier to create separate buttons with different onRelease functions?