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]