Why am i getting this error in this code

This is a very important question due to the fact i don’t know what this error means, it would be much appreciated if i could have any assistance, that is my code.

 

MY ERROR

File: error loading module ‘level2’ from file ‘level2.lua’

Error loading module ‘level2’ from file ‘/Users/Bhupinder/Desktop/Old Desktop items not in use/carisma/move/testin/done/level2.lua’:

/Users/Bhupinder/Desktop/Old Desktop items not in use/carisma/move/testin/done/level2.lua:53: ‘then’ expected near ‘end’

 

the end problem in the code is local textlistiner function

stack traceback:

[C]: in function ‘error’

?: in function ‘gotoScene’

level1.lua:44: in function <level1.lua:37>

?: in function ‘dispatchEvent’

?: in function ‘_nextTransition’

?: in function <?:1492>

(tail call): ?

?: in function <?:498>

?: in function <?:221>

 

the end problem in the code is local textlistiner function

 

 

MY CODE

[lua]local composer = require(“composer”)
local scene = composer.newScene()
local myData = require(“myData”)
local field
– “scene:create()”
function scene:create( event )
local sceneGroup = self.view
– Initialize the scene here.
– Example: add display objects to “sceneGroup”, add touch listeners, etc.
end
– “scene:show()”
function scene:show( event )
local sceneGroup = self.view
local phase = event.phase
if ( phase == “will”) then
local secondsLeft = 20 * 60 – 20 minutes * 60 seconds
local clockText = display.newText(“20:00”, display.contentCenterX, 80)
local function updateTime()
– decrement the number of seconds
secondsLeft = secondsLeft - 1
– time is tracked in seconds. We need to convert it to minutes and seconds
local minutes = math.floor( secondsLeft / 60 )
local seconds = secondsLeft % 60
– make it a string using string format.
local timeDisplay = string.format( “%02d:%02d”, minutes, seconds )
clockText.text = timeDisplay
if timeDisplay == “19:40” then
if field then
field:removeSelf()
elseif
field2:removeSelf()
end
clockText:removeSelf()
composer.gotoScene(“menu”)
end
– run them timer
local countDownTimer = timer.performWithDelay( 1000, updateTime, secondsLeft )
local function textListener( event )
local txt = event.target.text
if ( event.phase == “ended” or event.phase == “submitted”) then
end
end
end
field = native.newTextField ( 150, 150, 180, 30)
field:addEventListener(“userInput”, textListener)
field.autocorrectionType = “UITextAutocorrectionTypeNo”
elseif ( phase == “did”) then
end
end
– “scene:hide()”
function scene:hide( event )
local sceneGroup = self.view
local phase = event.phase
if ( phase == “will” ) then
– Called when the scene is on screen (but is about to go off screen).
– Insert code here to “pause” the scene.
– Example: stop timers, stop animation, stop audio, etc.
elseif ( phase == “did” ) then
– Called immediately after scene goes off screen.
end
end
– “scene:destroy()”
function scene:destroy( event )
local sceneGroup = self.view
– Called prior to the removal of scene’s view (“sceneGroup”).
– Insert code here to clean up the scene.
– Example: remove display objects, save state, etc.
end


– Listener setup
scene:addEventListener( “create”, scene )
scene:addEventListener( “show”, scene )
scene:addEventListener( “hide”, scene )
scene:addEventListener( “destroy”, scene )


return scene[/lua]

Please don’t ask the same question twice. This is against the forum rules.https://coronalabs.com/blog/2013/04/02/corona-forum-rules-and-guidelines/Rob

Please don’t ask the same question twice. This is against the forum rules.https://coronalabs.com/blog/2013/04/02/corona-forum-rules-and-guidelines/Rob