Quick syntax help

Hey there,
i am trying to create a matching game, anyways im trying to pass the id from a ui button too a variable.

what i have is…
[lua]local choice_1
local choice_2
local choice_3
local choice_4
local choice_5
local choice_6

local checkForMatch = function()

if firstChoice == secondChoice then
print(“Success!”)
else
print(“Failure!”)
end
end

local unHideChoice = function( event )
if event.phase == “release” then
if isFirstChoiceMade == false then
firstChoice = event.id
whatToChange = choice_…(firstChoice)
whatToChange.alpha = 0
isFirstChoiceMade = true
print(firstChoice)
else
secondChoice = event.id
checkForMatch()
end

end
end

choice_1 = ui.newButton{
defaultSrc = “hidden.png”,
defaultX = 50,
defaultY = 50,
onEvent = unHideChoice,
id = 1
}

choice_2 = ui.newButton{
defaultSrc = “hidden.png”,
defaultX = 50,
defaultY = 50,
onEvent = unHideChoice,
id = 1
}

[/lua]

So i am trying to make it so the “whatToChange” variable uses “choice_” and then i want to take the id from my ui button and place it in there.
What is the correct way to do this? thanks in advance

[import]uid: 19620 topic_id: 18115 reply_id: 318115[/import]

What I would do personally is just have the individual buttons change an upValue somewhere above your functions, and have your ‘checkMatch()’ function assess what to do with the data in that variable (that is changed from the individual buttons).

BUT to access data from another object, you can just assign a property to it, and in your listener, access it via event.target. [import]uid: 52430 topic_id: 18115 reply_id: 69272[/import]

such a simple answer, event.target, forgot about that one… thanks jonathan! [import]uid: 19620 topic_id: 18115 reply_id: 69277[/import]