Pass an argument when button pressed

Just wondering how this is possible, I am at work and don’t have my code handy to show what I’m trying to do but basically a button gets created when something is dragged on the main section from the sidebar and when that button is pressed I need to reference the something it is created with.

Thanks

Joel

Not 100% sure I understood the question, but assuming no typos below, this would pass data to the listener.

local circ = display.newCircle( 10, 10, 10 ) circ.touch = function( self, event ) if( event.phase == "ended" ) then if( self.mydata ) then for k,v in pairs( self.mydata ) do print(k,v) end end end return false end circ:addEventListener("touch") circ.mydata = { Corona = "Rocks", RoamingGamer = "is", helpful = "Yes" }

Omg  :lol:

circ.mydata = { Corona = "Rocks", RoamingGamer = "is", helpful = "Yes" }

Haha!

Not 100% sure I understood the question, but assuming no typos below, this would pass data to the listener.

local circ = display.newCircle( 10, 10, 10 ) circ.touch = function( self, event ) if( event.phase == "ended" ) then if( self.mydata ) then for k,v in pairs( self.mydata ) do print(k,v) end end end return false end circ:addEventListener("touch") circ.mydata = { Corona = "Rocks", RoamingGamer = "is", helpful = "Yes" }

Omg  :lol:

circ.mydata = { Corona = "Rocks", RoamingGamer = "is", helpful = "Yes" }

Haha!