hi, i can’t stop my boucle
the goal is find the nearest character from my event.x from a touch function and assign to him a function.
the snippet :
--cnt.comment=0 --#character=30 local function commentCharacter(event,character) for i=1,#character do print(character[i].x,character[i].y) if character[i].x +150 \> event.x and character[i].x -150 then cnt.comment=cnt.comment+1 if cnt.comment == 1 then cnt.comment=0 print(i,"i") end end end end commentCharacter(event,character) --result : i,1 i,4 i,8
or what i would like is only a value
--result: i,1
thanks for your help.