Newb needs help.
I am having trouble passing a parameter from an event listener to a function. When I tap the button, I want it to pass the value of the button to the numberTapped function, so that I can display it on the screen, but it doesn’t work. So now I am testing by printing the value of number to the terminal, but it only prints “nil”.
local function numberTapped(event, number) print(number) end oneButton = display.newImage( "/images/one.png" ) oneButton.x = display.contentWidth / 2 - 110 oneButton.y = display.contentHeight - 430 oneButton:addEventListener ( "tap", numberTapped, 1 )
Any help is greatly appreciated.
Dalbelo