okay, here’s an example that shows the problem [SOLVED]:
[code]local storyboard = require( “storyboard” )
local scene = storyboard.newScene()
local var1
local var2
local var3
local theTimer
function scene:createScene( event )
var1 = 1 – must reset vars here
var2 = “String”
var3 = “Start new String”
local group = self.view
var3 = var3…" + end new String"
print (var1…" / “…var2…” / "…var3)
end
function scene:willEnterScene( event )
local group = self.view
print (“willEnterScene”)
end
function scene:enterScene( event )
local group = self.view
print (“enterScene”)
local function wrap1 ()
print ("getCurrentSceneName: "…storyboard.getCurrentSceneName())
storyboard.purgeScene(“scene1”)
storyboard.gotoScene( “scene1”, “fade”, 1500 )
end
var1 = 1000 – vars have changed during game
var2 = “It’s the String! But now it’s different!”
var3 = “_something has changed!_”
timer.performWithDelay( 1000, wrap1, 1 )
end
function scene:exitScene( event )
local group = self.view
print (“exitScene”)
end
function scene:didExitScene( event )
local group = self.view
print (“didExitScene”)
end
function scene:destroyScene( event )
local group = self.view
print (“destroyScene”)
end
function scene:overlayBegan( event )
local group = self.view
local overlay_name = event.sceneName
end
function scene:overlayEnded( event )
local group = self.view
local overlay_name = event.sceneName
end
scene:addEventListener( “createScene”, scene )
scene:addEventListener( “willEnterScene”, scene )
scene:addEventListener( “enterScene”, scene )
scene:addEventListener( “exitScene”, scene )
scene:addEventListener( “didExitScene”, scene )
scene:addEventListener( “destroyScene”, scene )
scene:addEventListener( “overlayBegan”, scene )
scene:addEventListener( “overlayEnded”, scene )
return scene
[/code]
I want to reload the scene from inside the scene (while the scene is being displayed).
I want all local vars to reset, i.e. the whole scene module. I’m beginning to think that this is a bug, because it worked fine in an older corona sdk build…
Any ideas?
EDIT: updated the code above, where it works. still have problems in the reloaded module…
EDIT II: okay. my fault! I take back the “bug”.
I had this lua module that was directly returning a display group.
like this:
local myGroup = display.newGroup()
-- creating a display object
-- insertin ig to group
return myGroup
it works! (once.)
I turned it to this
local myGroupTable = {}
myGroupTable.grabGroup = function()
local myGroup = display.newGroup()
-- creating a display object
-- insertin ig to group
return myGroup
end
return myGroupTable
now everything works fine. [import]uid: 70635 topic_id: 31887 reply_id: 127223[/import]