< Timer | CodeSamples | l3dprimitive >

---% Code tested with Luxinia 0.95 build Nov 15 2006
---% at 11/16/06 23:15:45
---%  bugged in 0.94 due to error in timer.lua

local function fire ()
  for i=1,9 do
    print("firering in ",i,"seconds")

    coroutine.yield(1000) -- continue in a second
  end

  for i=10,2,-1 do
    print(i*100,"ms left!")
    coroutine.yield(100) -- continue in 100 millisecs.
  end

  print "BOOM"
end

TimerTask.new(fire,1000) -- start countdown in a second