I want to call a function from a separate class or module when the button is touched. This code works fine when both the function and eventlistener are in the same file.
local function startGame(e)
if(e.phase == "ended") then
print "Game started";
end
end
button1:addEventListener("touch", startGame);
What I want to do is this…
button1:addEventListener("touch", GameManager:startGame());
GameManager would have the function startGame. What is the syntax for calling GameManager:startGame() when it is inside an event listener because usually the function wouldnt have the parenthesis
[import]uid: 39238 topic_id: 7078 reply_id: 307078[/import]