I have a table of ball physics objects.
And a right border static object with bounce=1
I want to know which ball collided with the borderRight object
From the manual:
" each collision event includes event.other, which contains the table ID of the other Corona display object involved in the collision. "
So it seems it returns only the table ID and not the ID of the object in that table… ?
Otherwise, this would not return an error:
local onLocalPostCollision = function ( self, event )
local b = balls -- a table
b[event.other].x = 0
--Error: ... attempt to index field '?' (a nil value)
end
borderRight.postCollision = onLocalPostCollision
borderRight:addEventListener( "postCollision", borderRight )
So do I have to explicitly give each ball object a name on creation?
And can that name be a whole number ? [import]uid: 186251 topic_id: 33212 reply_id: 333212[/import]
[import]uid: 21331 topic_id: 33212 reply_id: 132013[/import]