Runtime:addEventListener and classes - how to ?

I use simple Lua classes (http://lua-users.org/wiki/SimpleLuaClasses) and wolud like to use Runtime touch events - but how do I connect events with classes:

-- Board.lua  
require ("class")  
  
Board = class()  
  
function Board:touched(touch)  
 print ("x="..touch.x.." state "..touch.phase)   
 print("r = "..self.r)  
end  
  
 -- begin listening for screen touches  
Runtime:addEventListener( "touch", touched )   
  
function Board:init()  
...  

This raises an assertion error , If declare the function as

function touched(touch) ...  

I get an runtime error because self ist not known (of course)

What is the solution ?

Kind regards for any help
[import]uid: 164057 topic_id: 29617 reply_id: 329617[/import]

sorry, this was a silly mistake:

I must setup the handler in the “calling” class:

[code]
level.lua:

local board = Board()

local function touched(touch)
board:touched(touch)
end

– begin listening for screen touches
Runtime:addEventListener( “touch”, touched )

Board.lua:

Board = class()

function Board:touched(touch)

end

[/code] [import]uid: 164057 topic_id: 29617 reply_id: 118894[/import]