I have down counting timer and want change scene when it is 0 but it does not work.
Code:
display.setStatusBar(display.HiddenStatusBar) \_W = display.contentWidth \_H = display.contentHeight number = 30
local txt\_counter = display.newText( number, 0, 0, native.systemFont, 50 )
txt\_counter.x = \_W/2
txt\_counter.y = \_H/2
txt\_counter:setTextColor( 255, 255, 255 )
function fn\_counter()
number = number - 1
txt\_counter.text = number
if number \< 1 then
director.changeScene("scene1")
end
end
tmr = timer.performWithDelay(1000, fn\_counter, number, 0)
Error
Runtime error
/Users/Yurandus/Desktop/timer/main.lua:12: attempt to index global ‘director’ (a nil value)
stack traceback:
[C]: ?
/Users/Yurandus/Desktop/timer/main.lua:12: in function ‘_listener’
?: in function <?:531>
?: in function <?:226> [import]uid: 115740 topic_id: 34922 reply_id: 334922[/import]
