' Timer callbacks in my-basic: a def is armed on a repeating timer, counts ticks in a global,
' and after the third tick cancels its own timer and ends the run.
' run: bin/calog examples/scripts/libraries/timerInMyBasic.bas

n = 0
tid = 0

def tick()
  n = n + 1
  calogPrint("my-basic tick", n)
  if n >= 3 then
    timerCancel(tid)
    calogExit(0)
  endif
enddef

tid = timerEvery(80, tick)
calogPrint("my-basic armed a repeating timer with a def callback")
