wait or wait_for

Hi guys. i need a function like “wait_for” or just “wait”

here is what i mean:

local some\_another\_variable\_is\_true=1 local strestimer\_start=0 function die\_from\_stress() --{     if(some\_another\_variable\_is\_true==1)then     wait\_for(some\_another\_variable\_is\_true) ----This     --OR     --[[    while(some\_another\_variable\_is\_true==1) ------Or this     {         wait(1)     }     --]] end     die() stres=0   strestimer\_start=0        end --} function main() if(stres\>7)then --{     if(strestimer\_start==0)then    strestimer=timer.performWithDelay( 5000, die\_from\_stress, 1 )--die after 5 seconds     strestimer\_start=1     end     end --} end Runtime:addEventListener( "enterFrame", main)

Any suggestions are welcome. Thanks.

ok. i found a workaround.

 function die\_from\_stress() --{  if(some\_another\_variable\_is\_true==1) then return end timer.cancel(strestimer0) timer.cancel(strestimer) die()     end --} function die\_from\_stress0() --{ strestimer0=timer.performWithDelay( 1,die\_from\_stress, -1 ) --check forever end --} strestimer=timer.performWithDelay( 5000, die\_from\_stress0, 1 )--die after 5 seconds

Hi.

If your program won’t be much more complex, your workaround might be just fine.

If you really do want to play around with waiting, on the other hand, I gave some suggestions on that here.

Thank you, StarCrynch! Your tutorial is wonderful!

ok. i found a workaround.

 function die\_from\_stress() --{  if(some\_another\_variable\_is\_true==1) then return end timer.cancel(strestimer0) timer.cancel(strestimer) die()     end --} function die\_from\_stress0() --{ strestimer0=timer.performWithDelay( 1,die\_from\_stress, -1 ) --check forever end --} strestimer=timer.performWithDelay( 5000, die\_from\_stress0, 1 )--die after 5 seconds

Hi.

If your program won’t be much more complex, your workaround might be just fine.

If you really do want to play around with waiting, on the other hand, I gave some suggestions on that here.

Thank you, StarCrynch! Your tutorial is wonderful!