Quantcast

Cleaned up the loading a bit

Adrian L Lange [08-07-09 - 18:03]
Cleaned up the loading a bit
Filename
pError.lua
diff --git a/pError.lua b/pError.lua
index 2c13ddc..8fb6791 100644
--- a/pError.lua
+++ b/pError.lua
@@ -12,7 +12,7 @@
 local next = next
 local find, lower = string.find, string.lower

-local addon = CreateFrame('Frame')
+local addon = CreateFrame('Frame', 'pError')
 local orig = UIErrorsFrame:GetScript('OnEvent')

 local function slashCommand(str)
@@ -55,14 +55,14 @@ end

 addon:RegisterEvent('ADDON_LOADED')
 addon:SetScript('OnEvent', function(self, event, name)
-	if(name == 'pError') then
-		self:SetScript('OnEvent', nil)
+	if(name ~= self:GetName()) then return end

-		pErrorDB = pErrorDB or {}
+	self:SetScript('OnEvent', nil)

-		SLASH_pError1 = '/perror'
-		SlashCmdList[name] = function(str) slashCommand(lower(str)) end
+	pErrorDB = pErrorDB or {}

-		UIErrorsFrame:SetScript('OnEvent', onEvent)
-	end
+	SLASH_pError1 = '/perror'
+	SlashCmdList[name] = function(str) slashCommand(lower(str)) end
+
+	UIErrorsFrame:SetScript('OnEvent', onEvent)
 end)