Idle loop to wait for animation to finish

Hi,
I guess I am unable to think , got the developer’s block…

I want to achieve this

[lua]doing=true
DoSomething(param1,paramn)

while doing==true do
–idle and wait
– do nothing
end

doing=true
DoSomething(param1,paramn)

while doing==true do
–idle and wait
– do nothing
end[/lua]

I want to run the routine maybe twice or more than that, but I want to also wait for the doSomething to return before it moves to the next one.

Almost like a spawnAndWaitToFinish(function)

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 10331 reply_id: 310331[/import]

Multithreading is not possible, at least easily, in lua, AFAIK. however it seems that all you want to do is call a function a number of times. In a functional language like lua just call the function and everything else will wait for it’s execution to finish. [import]uid: 8271 topic_id: 10331 reply_id: 37698[/import]