you can try something like this : btn1 has an id of ‘1’, btn2 has an id of ‘2’
local widget = require( "widget" ) local choice local function onButton( event ) local target = event.target if event.phase == "ended" then if target.id == 1 then choice = "MICKEY" else choice = "DONALD" end print(" choice is " .. choice) end end local btn1 = widget.newButton { defaultFile="Textures/Buttons/button.png", overFile="Textures/Buttons/button\_Dn.png", width = 100, height = 30, id = 1, label = "MICKEY", onEvent = onButton } btn1.x = 100 btn1.y = 50 local btn2 = widget.newButton { defaultFile="Textures/Buttons/button.png", overFile="Textures/Buttons/button\_Dn.png", width = 100, height = 30, id = 2, label = "DONALD", onEvent = onButton } btn2.x = 200 btn2.y = 50
as far as get and set, check out this link to the corona documentation for composer.setVariable and composer.getVariable … it explains it fairly well
https://docs.coronalabs.com/api/library/composer/setVariable.html
good luck
Bob