While dead simulator

Happy day.

When I run this while-bucle , simulator not work and dead.


while 1 do

            sleep(5)
            mirar()   

end


How I can run function “mirar()” every 60 seconds???

Best regards.

Hi @albervlc,

A timer is the best approach for this. For example:

[lua]

local mirarTimer = timer.performWithDelay( 60000, mirar, 0 )

[/lua]

See the documentation here:

https://docs.coronalabs.com/api/library/timer/performWithDelay.html

Best regards,

Brent

Very thanks Brent.

I am new in Corona.

I try :

timer.performWithDelay(10000,mirar,-1)

and works fine.

This is just I need.

This is like “setInterval()”

Best regards

Hi @albervlc,

A timer is the best approach for this. For example:

[lua]

local mirarTimer = timer.performWithDelay( 60000, mirar, 0 )

[/lua]

See the documentation here:

https://docs.coronalabs.com/api/library/timer/performWithDelay.html

Best regards,

Brent

Very thanks Brent.

I am new in Corona.

I try :

timer.performWithDelay(10000,mirar,-1)

and works fine.

This is just I need.

This is like “setInterval()”

Best regards