Corona SDK is an event driven system. There are many things that happen asynchronously… that is you make the call and instead of pausing while it waits, it goes on and does the next thing in the code. When the event happens, in this case your timer expires and your afterTimer() function gets called, then you have to handle the event there.
There isn’t a concept of stop and wait for a period of time. So if you have this:
function afterTimer() print("Timer is done!") end timer.performWithDelay(3000, afterTimer, 1) print("Now do something else")
The “Now do something else” will always print immediately and 3 seconds later “Timer is done!” will print. What you are really wanting is:
function afterTimer() print("Timer is done!") print("Now do something else") end timer.performWithDelay(3000, afterTimer, 1)