Hi, I’m working on my first project atm and am getting stuck (have been on this issue for a while)
I’ve tried originally using buttons and onEvent contained within them to do this, but i couldn’t get that to work. Now I’ve tried using event listeners but im stuck here as well.
my code is as follows
hand[i]:addEventListener( "touch", {function selecting( event ) selected = i end} )
hand is a table (a hand of cards for a player) and this is in a for i,v in pairs statement hence the use of ‘i’. What I’m trying to do is record which card is being ‘selected’ or touched in order to use in other parts of the code. however i cant seem to work out the syntax to do this.
previously I had
hand[i]:addEventListener( "touch", selected = i )
however it was telling me a ) was missing near = which im guessing it expected something like ( “touch”, selected)
any help would be appreciated, thanks!