Hello Rob, and thanks for the answer. I have created two storyboard scenes and I still can’t find a way to save the variable and load it.
Here are my files:
main.lua
local storyboard = require "storyboard" storyboard.gotoScene( "scene1" )
scene1.lua
local storyboard = require( "storyboard" ) local scene = storyboard.newScene() ---------------------------------------------------------------------------------- local variable local text local funct function funct( self, event ) if event.phase == "began" then storyboard.gotoScene( "scene2", "crossFade", 75 ) return true end end function scene:createScene( event ) local group = self.view variable = math.random(1,10) text = display.newText(variable, display.contentWidth / 2 ,display.contentHeight / 2, "Verdana", 40) text:setTextColor( 255,255,255 ) screenGroup:insert( text ) text.touch = funct text:addEventListener( "touch", text ) end function scene:enterScene( event ) local group = self.view storyboard.purgeAll() end function scene:exitScene( event ) local group = self.view storyboard.testVar = { [1] = variable } end function scene:destroyScene( event ) local group = self.view end scene:addEventListener( "createScene", scene ) scene:addEventListener( "enterScene", scene ) scene:addEventListener( "exitScene", scene ) scene:addEventListener( "destroyScene", scene ) return scene
and scene2.lua
local storyboard = require( "storyboard" ) local scene = storyboard.newScene() ---------------------------------------------------------------------------------- local variable local text function scene:createScene( event ) local group = self.view text = display.newText(variable, display.contentWidth / 2 ,display.contentHeight / 2, "Verdana", 90) text:setTextColor( 255,255,255 ) screenGroup:insert( text ) end function scene:enterScene( event ) local group = self.view variable = storyboard.testVar[1] storyboard.purgeAll() end function scene:exitScene( event ) local group = self.view end function scene:destroyScene( event ) local group = self.view end scene:addEventListener( "createScene", scene ) scene:addEventListener( "enterScene", scene ) scene:addEventListener( "exitScene", scene ) scene:addEventListener( "destroyScene", scene ) return scene
I still need some help! Thank you!