Assertion failed error with "Runtime:addEventListener'

Hello guys.

My code was working fine until today where i modified. Of course I try to retrace my steps but for some reason it is not enough! Now I am getting the following error:

--------------------------------
Runtime error
assertion failed!
stack traceback:
[C]: ?
[C]: in function 'assert'
?: in function 'getOrCreateTable'
?: in function 'addEventListener'
?: in function 'addEventListener'
...clairdm\DOCUME~1\CORONA~2\Sandbox\129\gameScreen.lua:949: in - 32,768 bytes

----------------------------------

AND HERE THE INFAMOUS 949 LINE!

#949 line-----> Runtime:addEventListener( "enterFrame" ,main )

If I remove that line I do not get the assertion error any longer but of course nothing is update on the screen. The main() has my logic but EVEN if comment everything single line of code in the main() it still gives me the error. The only way to get ride of the error is to comment the Runtime:addEventListener( "enterFrame" ,main )

I have other Runtime event listerners after line #949 but the only one causing problem is the line #949

It is kind of hard to past the complete code and also hard to give a simplify version but in essence that what I do (using director 1.2)

1- init() the game (loading properyBag....)
2- start runtime listener like enterframe and button touch,joystick...
3- Main(): main loop where a update game objects and so on.

What's killing me is that worked before my couple of modifications today. Again I tried to retrace my steps but no luck.

I guess i am not asking someone to find my errors (I am still continuing to see what I did wrong) BUT I would really be curious what could prompt this type of assertion error? I am used to errors where the terminal says something like problem on line X and I am usually pretty good a finding the problem but I have to admit I am STUCK now:(

Any pointers on what usually brings assertion errors would be most appreciated it!

Thank you guys.

Mo

When I experience this error, it usually means that I have yet to create the function or it cannot be found. In your case, you have made the function. Your function (main) may be inaccessible to that function or section of code from where you are calling main. Is the function main local? If so, try it as a global function. Is the function you are calling from in a module or external file? If so, make sure that the module is properly referenced or try the code in the main.lua file.

Another thing to try is just calling the main function without the Event Listener and see what happens. Personally, I haven't had much experience with the EnterFrame event but I don't think that is related, testing by just calling it should double check that.

Luke

Thank you SO much obeliskgames. I think you are into something when you say main maybe not be accessible for some reason. I will try your suggestions and report back.

Again that is why I LOVE this forum!

Mo

Thanks again obeliskgames! You saved the day for me. I found a stupid mistake (I was missing an "end" in a for loop) I am pretty sure it happened when I was modifying my code.

THANKS!

Mo.

Note to self: Save a copy of the code every day before starting working a code!!

views:2031 update:2011/10/5 8:48:05
corona forums © 2003-2011