I have a function that will change the color of a text once it reaches 5 seconds.
[lua] local function checkTime (event)
if active == true then
if timeRemain <6 and timeRemain~=0 then
–media.playEventSound(buz)
countdowntxt:setTextColor(255,0,0)
growTmr = timer.performWithDelay(.00001, grow, 1)
growTmr = timer.performWithDelay(200, shrink, 1)
end
end
end
codeRed = timer.performWithDelay(1000.0000001, checkTime, 0)[/lua]
But every once in a while i will get this error in the terminal:
Runtime error
…/Desktop/Corona Projects/Warp Speed/easyGame.lua:251: attempt to call method ‘setTextColor’ (a nil value)
stack traceback:
[C]: in function ‘setTextColor’
…mith/Desktop/Corona Projects/Warp Speed/easyGame.lua:251: in function ‘_listener’
?: in function <?:446>
?: in function <?:215> [import]uid: 66117 topic_id: 17361 reply_id: 317361[/import]