Timer and threads

Hi All

Im really new here and Im trying to understand how Corona Works.

Ive write this code:

function teste1()  
 local tempo = system.getTimer()  
 print ("Start teste 1: "..tempo)  
 local textObject = display.newText( "TigerFish", 50, 50, nil, 30 )  
 textObject:setTextColor( 255,255,255 )  
 textObject.alpha = 0;  
 transition.to ( textObject, { time = 5000, alpha = 1 } )  
 local tempo = system.getTimer()  
 print ("Final teste1: "..tempo)  
end  
  
function teste2()  
 local tempo = system.getTimer()  
 print ("Start teste 2: "..tempo)  
 local textObject = display.newText( "Cooking Wicca", 50, 75, nil, 30 )  
 textObject:setTextColor( 0, 0, 255 )  
 textObject.alpha = 0;  
 transition.to ( textObject, { time = 5000, alpha = 1 } )  
 print ("Final teste2: "..tempo)  
end  
  
-- Logic  
local tempo = system.getTimer()  
print("Start: "..tempo)  
teste1()  
teste2()  

When the code runs on the simulator, both functions appear to work one after another (see the processing time in the terminal). However, seeing the program running, despite the time of each function to be succeeding each other, the threads seem to run together, or with very close time. In the terminal, it is possible to see the ending time of Processing of each function, but on screen, you can see each function separately functioning.

How should I interpret this?

It is possible to make a function work exactly and ONLY after the previous function fully have processed all of your commands?

In other words, how to capture this time, after a 2 seconds fade (2000 milliseconds) to be exactly the sum of the previous function + fade?

test1: 30ms
Test2: 2030ms (30 + seconds fade 2000)

Id like to second function only works after de first one run all commands

Sorry if I was too wordy
(Translated with google translator) [import]uid: 9133 topic_id: 3271 reply_id: 303271[/import]