Please refer to this topic (I cannot post there for some reason):
http://forums.coronalabs.com/topic/30981-runtime-error-bad-argument-2/
I’m getting this error when I try to use gotoScene
Runtime error
bad argument #-2 to ‘insert’ (Proxy expected, got nil)
stack traceback:
[C]: ?
[C]: in function ‘insert’
?: in function ‘?’
?: in function ‘gotoScene’
…ocuments\corona projects\stuck_scenes\guess_word.lua:230: in function
‘_listener’I came across this error again today in another scene. I discovered that, in the scene I was leaving I was either calling storyboard.purge/remove(“scene”) in the exitScene(). After I removed this it worked fine. I also have a question about memory management, Do I have to manually remove and nil out every table I use?
Gooner87 is right, I am having this error too. And Gooner87 just saved my day to identify the cause.
I call storyboard.purge(“current theme name”) in exitScene() too.
And it worked perfect until today I try to call gotoScene(“current storyboard name”) in a keyboard pressed handler in my main.lua because I want to handle Android back event. So the scenario is this
(1) Current storyboard, say “Scene 1”
(2) The user presses back key
(3) In my main.lua, a function handles the key event, and checks if current theme is “Scene 1”… if yes, gotoScene(“Scene 2”)
(4)-a If “Scene 1” has storyboard.purge(“Scene 1”) in exitScene(), the error happens (app crashes).
-b If “Scene 1” does not have it, no error
-c If I call "storyboard.purge(“Scene 1”) in key handling event, no error (but I cannot do this, because I can’t know if I should purge it or not in key handling event, besides if I do, the code structure would become spaghetti)
I think calling storyboard.purge() in exitScene() is quite often and normal? Is this a bad behavior?
Or is this something Corona could fix?