addEventListener() in Lua
snippet in lua

addEventListener() in Lua

user6953

local function listener(param1, param2)
        return function(event)
                print(event.name, event.phase, param1, param2)
        end
end

Runtime:addEventListener("touch", listener(12, 33))
Runtime:addEventListener("tap", listener(55, 77))

addEventListener() in Lua

user8459

local touchHandler = function( event )
    if event.phase == "began" then
        local t = event.target
        print( "param1=" .. t.param1 .. ", param2=" .. t.param2 )
    end
end

local image1 = display.newImageRect( "myImage.png", 100, 100 )
image1.param1 = "Apple"
image1.param2 = "Zucchini"
image1:addEventListener( "touch", touchHandler )

local image2 = display.newImageRect( "myImage.png", 100, 100 )
image2.param1 = "AC/DC"
image2.param2 = "ZZ Top"
image2:addEventListener( "touch", touchHandler )