I have been editing the test eBook to try and make a crude random number generator.
The title.lua had the work background changed temporarily just to see what would happen (it broke) but I think changed everything back, or so I thought. It is generating an error stating "title.lua:35: attempt to index upvalue ‘background’ (a nil value)
Even after making a new example eBook and importing the code from it into my project, I still get this error.
----------------------------------------------------------------------------------------- -- -- title.lua -- ----------------------------------------------------------------------------------------- local composer = require( "composer" ) local scene = composer.newScene() -------------------------------------------- -- forward declaration local background -- Touch listener function for background object local function onBackgroundTouch( self, event ) if event.phase == "ended" or event.phase == "cancelled" then -- go to page1.lua scene composer.gotoScene( "page1", "slideLeft", 800 ) return true -- indicates successful touch end end function scene:create( event ) local sceneGroup = self.view -- Called when the scene's view does not exist. -- -- INSERT code here to initialize the scene -- e.g. add display objects to 'sceneGroup', add touch listeners, etc. -- display a background image background = display.newImageRect( sceneGroup, "cover.jpg", display.contentWidth, display.contentHeight ) background.anchorX = 0 background.anchorY = 0 background.x, background.y = 0, 0 -- Add more text local pageText = display.newText( "[Touch screen to continue]", 0, 0, native.systemFont, 18 ) pageText.x = display.contentWidth \* 0.5 pageText.y = display.contentHeight - (display.contentHeight\*0.1) -- all display objects must be inserted into group sceneGroup:insert( background ) sceneGroup:insert( pageText ) end function scene:show( event ) local sceneGroup = self.view local phase = event.phase if phase == "will" then -- Called when the scene is still off screen and is about to move on screen elseif phase == "did" then -- Called when the scene is now on screen -- -- INSERT code here to make the scene come alive -- e.g. start timers, begin animation, play audio, etc. background.touch = onBackgroundTouch background:addEventListener( "touch", background ) end end function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if event.phase == "will" then -- Called when the scene is on screen and is about to move off screen -- -- INSERT code here to pause the scene -- e.g. stop timers, stop animation, unload sounds, etc.) -- remove event listener from background background:removeEventListener( "touch", background ) elseif phase == "did" then -- Called when the scene is now off screen end end function scene:destroy( event ) local sceneGroup = self.view -- Called prior to the removal of scene's "view" (sceneGroup) -- -- INSERT code here to cleanup the scene -- e.g. remove display objects, remove touch listeners, save state, etc. end --------------------------------------------------------------------------------- -- Listener setup scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) ----------------------------------------------------------------------------------------- return scene