From c4a8fc915bc47fba0254f9aa2bbf5826fdc099b8 Mon Sep 17 00:00:00 2001 From: torhal Date: Tue, 22 Sep 2009 08:33:26 +0000 Subject: [PATCH] In addon:OnInitialize(): Set addon.version based on metadata. In addon:OnEnable(): Initialize the main frame via addon:InitializeFrame(), then nil it out. Removed five unnecessary nil settings for variables/members which don't even exist at that point. --- AckisRecipeList.lua | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/AckisRecipeList.lua b/AckisRecipeList.lua index be98423..902203d 100644 --- a/AckisRecipeList.lua +++ b/AckisRecipeList.lua @@ -81,11 +81,6 @@ local BFAC = LibStub("LibBabble-Faction-3.0"):GetLookupTable() -- Global Frame Variables addon.optionsFrame = {} -addon.ScanButton = nil -addon.Frame = nil -addon.ARLCopyFrame = nil -_G["arlTooltip"] = nil -_G["arlSpellTooltip"] = nil -- Make global API calls local to speed things up local GetNumTradeSkills = GetNumTradeSkills @@ -281,13 +276,16 @@ function addon:OnInitialize() } } } - - addon.db = LibStub("AceDB-3.0"):New("ARLDB2",defaults) + addon.db = LibStub("AceDB-3.0"):New("ARLDB2", defaults) if (not addon.db) then self:Print("Error: Database not loaded correctly. Please exit out of WoW and delete the ARL database file (AckisRecipeList.lua) found in: \\World of Warcraft\\WTF\\Account\\>\\SavedVariables\\") return end + local version = GetAddOnMetadata("AckisRecipeList", "Version") + version = string.gsub(version, "@project.revision@", "SVN") + self.version = version + self:SetupOptions() @@ -299,7 +297,6 @@ end ---Function run when the addon is enabled. Registers events and pre-loads certain variables. function addon:OnEnable() - self:RegisterEvent("TRADE_SKILL_SHOW") -- Make addon respond to the tradeskill windows being shown self:RegisterEvent("TRADE_SKILL_CLOSE") -- Addon responds to tradeskill windows being closed. @@ -340,7 +337,8 @@ function addon:OnEnable() --Create the button now for later use self:CreateScanButton() - + self:InitializeFrame() + self.InitializeFrame = nil end ---Run when the addon is disabled. Ace3 takes care of unregistering events, etc. @@ -2105,7 +2103,7 @@ function addon:GetTextDump(RecipeDB, profession) end end - return tconcat(texttable,"") + return tconcat(texttable, "") end -- 1.7.9.5