Hi.
I did something like it (a few weeks before I wrote the article) on the Corona Geek show, and it looks like I left it in that state, if you want to try that: coroutines sample
That said, this is what the full code would look like:
function CoroPerformWithDelay( delay, func, n ) local wrapped = coroutine.wrap( function( event ) func( event ) -- Do the action... return "cancel" -- ...then tell the timer to die when we're done. end ) local event2 -- Our "shadow" event. return timer.performWithDelay( delay, function( event ) event2 = event2 or { source = event.source } -- On first run, save source... event2.count = event.count -- ...update these every time. event2.time = event.time local result = wrapped( event2 ) -- Update the coroutine. It will pick up the event on the first run. if result == "cancel" then timer.cancel( event2.source ) -- After func completes, or on a cancel request, kill the timer. end end, n or 0 ) end function WaitUntilPropertyTrue( object, name, update ) while not object[name] do if update then update() end coroutine.yield() end end function DoSomethingElse () print("DONE!") end CoroPerformWithDelay(20, function() local rect = display.newRect( 100, 100, 50, 50 ) rect.isVisible = false timer.performWithDelay( 5000, function() rect.isVisible = true end ) WaitUntilPropertyTrue( rect, "isVisible" ) DoSomethingElse() -- This code should be excute 5 sec after the above line code end)