PageRenderTime 89ms CodeModel.GetById 40ms app.highlight 6ms RepoModel.GetById 34ms app.codeStats 6ms

/Tukui/modules/unitframes/core/oUF/factory.lua

http://github.com/Asphyxia/Tukui
Lua | 33 lines | 25 code | 8 blank | 0 comment | 2 complexity | 204788c46677169f7fc14cb3d2e84d37 MD5 | raw file
 1local parent, ns = ...
 2local oUF = ns.oUF
 3local Private = oUF.Private
 4
 5local argcheck = Private.argcheck
 6
 7local _QUEUE = {}
 8local _FACTORY = CreateFrame'Frame'
 9_FACTORY:SetScript('OnEvent', Private.OnEvent)
10_FACTORY:RegisterEvent'PLAYER_LOGIN'
11_FACTORY.active = true
12
13function _FACTORY:PLAYER_LOGIN()
14	if(not self.active) then return end
15
16	for _, func in next, _QUEUE do
17		func(oUF)
18	end
19end
20
21function oUF:Factory(func)
22	argcheck(func, 2, 'function')
23
24	table.insert(_QUEUE, func)
25end
26
27function oUF:EnableFactory()
28	_FACTORY.active = true
29end
30
31function oUF:DisableFactory()
32	_FACTORY.active = nil
33end