in my game.lua I have this:
function new()
local obj = display.newGroup();
currentLevel = Level.new(1);
currentLevel.game = obj; --also tried currentLevel.game = self;
function obj:replay()
print("game - replay")
end
return obj;
end
In the Level lua file, I try to call the replay function in game.lua:
game:replay();
But I get this error:
attempt to call method ‘replay’ (a nil value)
How can I keep a reference to the game file in level.lua? [import]uid: 52127 topic_id: 10102 reply_id: 310102[/import]