Really Weird Error

Every so often I get this error. Im unable to reproduce and its not telling me where the error is. Very odd.

1
2
3
4
5
6
Runtime error
        ?:0: attempt to index a nil value
stack traceback:
        [C]: ?
        ?: in function '?'
        ?: in function <?:215>

post your code and we'll try to figure it out

My own "every so often random crash without useful error message" was caused by calling physics.stop() when a level ended.

The fix was to remove/delete/nil EVERY SINGLE physical object in the old level after calling physics.stop(), prior to calling physics.start() again on the next level. Not doing that and my game loaded new levels fine most of the time, except randomly between 2-20 times after starting a new level when it would crash.

Simply relying on the old physical objects being trashed by a scene change with my scene manager cleanup function was NOT enough to clean up the physics world and avoid the crash. I had to backwards iterate through the display group where my physical objects lived and delete them all one at a time.

No idea if that's the cause of your crash, but if it is I just saved you about 5 days of hair pulling frustration.

I had a thread about that bug a while back. https://developer.anscamobile.com/forum/2011/07/01/runtime-error-nil-unusable-stack-trace-0

Recently I came across some weirdness with the addEventListener documented here: https://developer.anscamobile.com/forum/2011/08/01/possible-addeventlistener-bugs

Ever since I implemented my own event dispatching functions that bug went away. Here's another video showing the before and after: http://www.youtube.com/watch?v=SM1uU0llaIk

The error doesn't seem to hurt my application, but it's annoying if an error does occur and you have to sift through that.

views:1966 update:2011/9/28 8:56:32
corona forums © 2003-2011