GGTimer wraps up Coronas timer functionality and adds in toggling just for fun.
Lua
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
GGTimer.lua
README.md

README.md

GGTimer

GGTimer wraps up Coronas timer functionality and adds in toggling just for fun.

Basic Usage

Require The Code
local GGTimer = require( "GGTimer" )
Create a timer with a function listener
local onTimer = function( event )
    print( "A", event.count )
end

local timer = GGTimer:new( 1000, onTimer, 0 )
Create a timer with a table listener
local object = {}

function object:timer( event )
    print( "B", event.count )
end

local timer = GGTimer:new( 1000, object, 0 )
Start your timer
timer:start()
Pause your timer
timer:pause()
Resume your timer
timer:resume()
Resume your timer with a new delay
timer:resume( 5000 )
Cancel your timer
timer:cancel()
Toggle your timer on every tap
local onTap = function()
    timer:toggle()
end

Runtime:addEventListener( "tap", onTap )
Destroy your timer
timer:destroy()
timer = nil