if field 1 =nil then how would i get it to use field 2 as a replacement if field one doesn't work

if field 1 =nil then how would i get it to use field 2 as a replacement if field one doesn’t work

[lua]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 THIS IS NIL I WANT THE FUNCTION TO CHANGE TO–
field:removeSelf()
–I WANT IT TO CHANGE TO THIS–
field2:removeSelf()
clockText:removeSelf()
composer.gotoScene(“menu”)
end
end
– run them timer
local countDownTimer = timer.performWithDelay( 1000, updateTime, secondsLeft )[/lua]

it would be much appreciated for the assistance

I thought I had answered this. Perhaps you want to do:

if timeDisplay == "19:40" then     if field then         field:removeSelf()     elseif         field2:removeSelf()     end     clockText:removeSelf()     composer.gotoScene("menu") end

Also notice how my code is indented. It makes it much more readable.

Rob

it would be much appreciated for the assistance

I thought I had answered this. Perhaps you want to do:

if timeDisplay == "19:40" then     if field then         field:removeSelf()     elseif         field2:removeSelf()     end     clockText:removeSelf()     composer.gotoScene("menu") end

Also notice how my code is indented. It makes it much more readable.

Rob