
--===================================================
--									
--									GHI Timer
--								ghi_timer.lua
--
--	Calling of functions on a requested interval
--	
-- 						(c)2011 The Gryphonheart Team
--								All rights reservated
--===================================================

function GHI_Timer(func,interval)
	local class = GHClass("GHI_Timer");
	
	local lastCall = time();
	
	class:SetScript("OnUpdate",function(self)
		if time() > lastCall + interval then
			func();
			lastCall = time();
		end
	end);
	
	return class;
end
