how to get "type" in a function

hi
i want to get a type of an object in a function… but i’m having some problems

  
item = display.newImage( "gelo.png" )  
item.x = math.random( 480 )  
item.y = 100  
item.type = "gelo"  
item.id = "gelo"  
  
-- I have tried 2 ways... type and id  
  
teste = function(e)  
 if e.phase == "ended" then  
 print ( e.type )  
 print ( e.id )  
 end  
 end   
  
 item:addEventListener( "touch", teste )  

in terminal I get this:

nil
userdata: 0xc7400

how can I acess the type of my object in this function?? [import]uid: 23063 topic_id: 12105 reply_id: 312105[/import]

For touch events, e.target is a reference to the display object that was touched. e is just the event object.

Change your code to use e.target.type and e.target.id. [import]uid: 58455 topic_id: 12105 reply_id: 44123[/import]

thanks… now it’s working :smiley: [import]uid: 23063 topic_id: 12105 reply_id: 44129[/import]