When I open a file and I write in , the Corona simulator starts bugging. Here’s the code:
local storyboard = require ("storyboard") local scene = storyboard.newScene() local sfondo local start1 local start2 local crediti1 local tutorial1 local opzioni local scritta local sfumatura local contatore = 1 local GameMusic = audio.loadSound("suonovin.mp3") function scene:createScene(event) local screenGroup = self.view sfondo = display.newImage("sfondo iniziale.png") sfondo.x = display.contentWidth / 2 sfondo.y = display.contentHeight / 2.5 --sfondo:scale(0.6,0.6) screenGroup:insert(sfondo) scritta = display.newImage("scritta ctc.png") scritta.x = display.contentWidth / 2 scritta.y = display.contentHeight / 4 scritta:scale(0.14,0.14) screenGroup:insert(scritta) start1 = display.newImage("start logo.png") start1.x = display.contentWidth / 2 start1.y = display.contentHeight / 1.65 start1:scale(0.12,0.12) start2 = display.newImage("start logo.png") start2.x = display.contentWidth / 2 start2.y = display.contentHeight / 1.65 start2:scale(0.13,0.13) start2.isVisible = false screenGroup:insert(start2) crediti1 = display.newImage("credits tasto.png") crediti1.x = display.contentWidth / 5.7 crediti1.y = display.contentHeight / 1.65 crediti1:scale(0.12,0.12) screenGroup:insert(crediti1) tutorial1 = display.newImage("tutorial tasto.png") tutorial1.x = display.contentWidth / 1.2 tutorial1.y = display.contentHeight / 1.65 tutorial1:scale(0.11,0.11) screenGroup:insert(tutorial1) sfumatura = display.newImage("sfumatura.png") sfumatura.x = display.contentWidth / 2 sfumatura.y = display.contentHeight / 1.1 sfumatura:scale(0.17,0.17) screenGroup:insert(sfumatura) opzioni = display.newImage("opzioni tasto.png") opzioni.x = display.contentWidth / 2 opzioni.y = display.contentHeight / 1.2 opzioni:scale(0.15,0.15) screenGroup:insert(opzioni) local path = system.pathForFile("text.txt") local file = io.open( path, "w+" ) file:write("ciao") io.close(file) --local contents = file:read() --print(file:read("\*n")) end local function cambio( ... ) contatore = contatore + 1 if contatore == 1 then start1.isVisible = false start2.isVisible = true end if contatore == 2 then start1.isVisible = true start2.isVisible = false contatore = 0 end end timer1 = timer.performWithDelay(200, cambio, 0) function gotoStart( event ) audio.play(GameMusic, {channel = 1}) if event.phase == "ended" then storyboard.gotoScene("game", "fade", 300) end end function gotoCrediti( event ) audio.play(GameMusic, {channel = 1}) if event.phase == "ended" then storyboard.gotoScene("scene\_credits", "fade", 300) end end function gotoOptions( event ) audio.play(GameMusic, {channel = 1}) if event.phase == "began" then storyboard.gotoScene("main", "fade", 300) end end function scene:enterScene(event) storyboard.removeScene("scene\_credits") storyboard.removeScene("OPTIONS\_SCENE") start1:addEventListener("touch", gotoStart) start2:addEventListener("touch", gotoStart) crediti1:addEventListener("touch", gotoCrediti) opzioni:addEventListener("touch", gotoOptions) end function scene:exitScene(event) start1:removeEventListener("touch", gotoStart) start2:removeEventListener("touch", gotoStart) crediti1:removeEventListener("touch", gotoCrediti) opzioni:removeEventListener("touch", gotoOptions) display.remove(sfondo) display.remove(scritta) display.remove(start1) display.remove(start2) display.remove(crediti1) display.remove(tutorial1) display.remove(sfumatura) display.remove(opzioni) timer.cancel(timer1) end function scene:destroyScene(event) end scene:addEventListener("createScene", scene) scene:addEventListener("enterScene", scene) scene:addEventListener("exitScene", scene) scene:addEventListener("destroyScene", scene) return scene