View Single Post
02-09-12, 10:15 PM   #1
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
Mass confusion, loading process

OKay so I have always had some funny intermitent problems with my saved variables and it has always had to do with the way it clears default keys out... but i may have just noticed part of the problem... umm when is it that PLAYER_LOGIN fires? because the following code should not even work but yet its the only way i can get it to work properly... Notice there is a register for ADDON_LOADED in a PLAYER_LOGIN event so technically that addon loaded part should never run right? but it does!

Code:
addon.RegisterEvent("MoveFrames-Initialize", 'PLAYER_LOGIN', function(self, event)
	addon.UnregisterEvent(self, event)
	if addon.settings.movedFrames then
		movedFrames = addon.settings.movedFrames
	end
	if type(movedFrames) ~= 'table' then
		movedFrames = { }
		addon.settings.movedFrames = movedFrames
	end

	local function HookFrames(self, event)
		addon:DefaultMoveableFrames()
		VerCheckUpdate()
		
		moveableframes = CopyTable(GMoveableFrames)
		for name, parent in pairs(moveableframes) do
			if HookFrame(name, parent) then
				moveableframes[name] = nil
			end
		end
		if next(moveableframes) then return end
		addon.UnregisterEvent(self, event)
	end
	addon.RegisterEvent("MoveFrames-Hook", 'ADDON_LOADED', HookFrames)
	HookFrames("MoveFrames-Hook", 'ADDON_LOADED')
end)
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote