I know this has probably been asked a million times before but I certainly cant find the answer I’m looking for. Ive tried the method of using a restart.lua as a midstep scene for reseting but I keep getting this error
poem: createScene event
poem: enterScene event
You pressed and released the restart button!
poem: exitScene event
poem: exited
Runtime error
?:0: attempt to index field ‘?’ (a boolean value)
stack traceback:
[C]: ?
?: in function ‘gotoScene’
c:\users\graham\desktop\apptoonz\rhymegame\poem.lua:187: in function ‘on
Event’
?: in function <?:90>
?: in function <?:215>
reset button:
local function buildInterface()
-- RESTART BUTTON --
local restartButton = widget.newButton{
id = "restartButton",
left = display.contentWidth - 113 - 30,
top = display.contentHeight - 100 - 30,
label = "Restart",
width = 113, height = 100,
cornerRadius = 8,
onEvent=function(event)
if event.phase == "release" then
print( "You pressed and released the restart button!" )
storyboard.gotoScene("restart", "fade", 400 )
end
end
}
end
poem enterScene (sets StoryBoad.sceneName to poem)
function scene:enterScene( event )
print( "poem: enterScene event" )
-- remove previous scene's view
storyboard.purgeScene( storyboard.sceneName )
storyboard.sceneName = "poem"
end
restart.lua
local storyboard = require( "storyboard" )
local scene = storyboard.newScene()
----------------------------------------------------------------------
---------------------------- SCENE EVENTS ----------------------------
----------------------------------------------------------------------
-- Called when the scene's view does not exist:
function scene:createScene( event )
storyboard.purgeScene( storyboard.sceneName )
storyboard.sceneName = "restart"
print("restart: creating")
end
-- Called immediately after scene has moved onscreen:
function scene:enterScene( event )
print( "restart: enterScene event" )
storyboard.gotoScene( storyboard.sceneName, "fade", 400 )
end
-- Called when scene is about to move offscreen:
function scene:exitScene()
print( "restart: exitScene event" )
end
-- Called prior to the removal of scene's "view" (display group)
function scene:destroyScene( event )
print( "((destroying restart scene's view))" )
end
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
Any ideas? [import]uid: 134131 topic_id: 24645 reply_id: 324645[/import]