Notify when a process ends

Hi guys , is possible in Lua to know when a function end the internal process ? 

I mean , when i call a function ,the function starts to do something.If i call another function within that , is there any way to know how the first process ends?