An archive of community.esquilo.io as of Saturday January 26, 2019.

Timer Question, how to stop

JefferyS

Hi, I tried the timer for my temp probes and it worked pretty good except when I would kill the nut in the IDE it would keep going. Made it hard to trouble shoot other problems.

Is there any way to kill all timers using code? I could make a killTimer.nut and run that after I kill the nut?

Any help would be most appreciated.

Thanks,

Jeffery

Scott_Shumate

The upcoming release of EOS resets the Squirrel VM on a kill which will stop all of the timers. In the interim, you can use the following function to purge the VM of all timers:

function killTimers()
{
    local root = getroottable();
    foreach (k,v in root) {
        if (v instanceof Timer)
            root[k] = null;
    }
}
JefferyS

That's great Scott, thanks for the code. Look forward to the new EOS update.

Thanks,

Jeffery