Runtime error ?:0: attempt to call field '?' (a table value)

Howdy Corona Gurus,

I seem to have a strange problem I’ve spent about three hours trying to troubleshoot now and just can’t seem to make any head way.  I have a game in the market that has been running okay on the last public release.  But I needed to add support for iOS 7.  So I’ve tried a number of builds between the stable and that which introduced iOS 7 but keep getting this issue when I transition screens.  It seems to occur from my game screen to any other.  But I’m not getting enough info from the emulator to really know where to look.  The error message looks exactly like this in the console:

Runtime error

?:0: attempt to call field ‘?’ (a table value)

stack traceback:

    [C]: in function ‘?’

    ?: in function ‘?’

    ?: in function <?:516>

    ?: in function <?:218>

From my own debugging, it looks like the game scene itself runs thru both exitScene and didExitScene.  Whatever the next scene is seems to get thru create and willEnter, but never enter.  As I said you can go from several different screens in my app from the main game screen and the behavior seems to be the same no matter what scene I try to load next.  And I verified that going back to the last public build makes the issue go away.

Can anybody give me some tips?  The traceback has a couple line numbers but no functions or file name.

This sounds like it could be a bug but we have many people running storyboard with later daily builds.  The lack of function names and modules indicates that it’s happening inside one of our libraries.  But there is some useful information in the message.  It’s attempting to call a function but the pointer isn’t to a function but to a table instead.

This could be a case where maybe some global has written over something we expect to be there.   For instance:

transition.to = sometable

would generate this when Storyboard tries to call transition.to() for instance. Not that’s what happening, but it’s an example.  All of Corona’s API’s live in global space so look for any things that might be global that shouldn’t be.  Make sure you’ve not changed the definition of your scene:enterScene() functions anywhere with maybe scene.enterScene() or similar.

It would be good to know what the cause of this is, so if you can’t track it down, the next step would be to make a copy of your app and strip it down as much as you can that still demonstrates the bug and then file a bug report using the “Report a bug” link at the top of the page.  We would need to need that project to try and find the problem.

Thanks

Rob

Thanks, Rob.  After reading over your response I went into my code and commented out everything in the exitScene and didExitScene methods on my main game screen which seemed to be the common link to the error.  After that I added the lines back in one at a time and eventually came across the culprit.  My best guess is simply that the timing has changed slightly between the last public release and the newer daily builds that include iOS 7.  Regardless the error was my doing.  I was manually deleting a screen object that also belonged to the scene parent view.  The remove object call was in the on complete listener of an animation and it seems that on the newer builds the storyboard parent view had already removed the screen object before the animation listener fired.  I appreciate you getting me headed down the right path.  You guys are awesome.

This sounds like it could be a bug but we have many people running storyboard with later daily builds.  The lack of function names and modules indicates that it’s happening inside one of our libraries.  But there is some useful information in the message.  It’s attempting to call a function but the pointer isn’t to a function but to a table instead.

This could be a case where maybe some global has written over something we expect to be there.   For instance:

transition.to = sometable

would generate this when Storyboard tries to call transition.to() for instance. Not that’s what happening, but it’s an example.  All of Corona’s API’s live in global space so look for any things that might be global that shouldn’t be.  Make sure you’ve not changed the definition of your scene:enterScene() functions anywhere with maybe scene.enterScene() or similar.

It would be good to know what the cause of this is, so if you can’t track it down, the next step would be to make a copy of your app and strip it down as much as you can that still demonstrates the bug and then file a bug report using the “Report a bug” link at the top of the page.  We would need to need that project to try and find the problem.

Thanks

Rob

Thanks, Rob.  After reading over your response I went into my code and commented out everything in the exitScene and didExitScene methods on my main game screen which seemed to be the common link to the error.  After that I added the lines back in one at a time and eventually came across the culprit.  My best guess is simply that the timing has changed slightly between the last public release and the newer daily builds that include iOS 7.  Regardless the error was my doing.  I was manually deleting a screen object that also belonged to the scene parent view.  The remove object call was in the on complete listener of an animation and it seems that on the newer builds the storyboard parent view had already removed the screen object before the animation listener fired.  I appreciate you getting me headed down the right path.  You guys are awesome.