I have some relatively simple code and I am just trying to get timers to work. I keep getting this error: “Attempt to index upvalue ‘timer’ (a nil value)” when I try to make a timer. Please Help!
local composer = require( "composer" ) local scene = composer.newScene() local text -- "scene:create()" function scene:create( event ) local sceneGroup = self.view local options1 = { text = "VICTORY\nGOOD\nGAME", width = \_W\*.90, --required for multi-line and alignment font = textFont, fontSize = textSize\*1.8, align = "center" } text = display.newText( options1 ) text.x = centerX text.y = 500 sceneGroup:insert(text) end -- "scene:show()" function scene:show( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then -- Called when the scene is still off screen (but is about to come on screen). elseif ( phase == "did" ) then myMath.neonBuzz(text) local function listener() local options = { isModal = true, } composer.showOverlay( "gameOver", options ) end local function listener( event ) print( "listener called" ) end timer.performWithDelay( 1000, listener, 0 ) end end -- "scene:hide()" function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then elseif ( phase == "did" ) then end end -- "scene:destroy()" function scene:destroy( event ) local sceneGroup = self.view end -- ------------------------------------------------------------------------------- -- Listener setup scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) -- ------------------------------------------------------------------------------- return scene