I can remember having this problem a long time ago, and since I haven’t ran into it since then I assume it has been fixed, although it is not working for me at the moment.
If I use an alert view to confirm that the user wants to leave the scene, when they press ok I get the following error:
Runtime error bad argument #-2 to 'insert' (Proxy expected, got nil)
This is the code I am using:
local function requestEndScene(e) if e.phase == "ended" then local function onAlertComplete(event) if "clicked" == event.action then local i = event.index if i == 1 then storyboard.gotoScene("mainMenu") end end end native.showAlert( "End Game?", "Are you sure you want to end this game?", { "OK", "No" }, onAlertComplete ) end end
However if I change the requestEndScene function as follows:
local function requestEndScene(e) if e.phase == "ended" then storyboard.gotoScene("mainMenu") end end
then is works fine. Is there something I have missed that could be causing this problem?
The error implies that it is trying to insert something into a group, but if that was the case then why doesn’t the immediate call have the same error?
I think that last time I made my own popup as a workaround, but I’d rather not do that when the native alert would suffice.