TI-Nspire & Lua / タイマーの tick するたびに経過時間を出力する / グローバル変数に頼る

TI-Nspire & Lua / タイマーの tick するたびに経過時間を出力する / グローバル変数に頼らない / コルーチンを使ってみる
TI-Nspire & Lua / タイマーの tick するたびに経過時間を出力する / グローバル変数に頼らない / クロージャを使ってみる
TI-Nspire & Lua / タイマーの tick するたびに経過時間を出力する / グローバル変数に頼らない / クラスを使ってみる の続き

Every time a timer ticks, the following script will return the elapsed time.
.lua

initTime = timer.getMilliSecCounter()
Counter = 0 

-------------------------------------------------
-------------------------------------------------
-------------------------------------------------
function on.construction()
   var.store("time", {})
   on.timer()
   timer.start(2)
end
function on.timer()
   Counter = Counter + 1
   local Time = (timer.getMilliSecCounter() - initTime) / 1000
   var.storeAt("time", Time, Counter)
end