# HG changeset patch # User Nenue # Date 1467837019 14400 # Node ID d11b67d25aeebcb761db1bcc2b1033632e9b4cea # Parent 1b2d6d4a54fdf57912756b250a324375392d2101 - Added some title info manipulation to make DVN more prevalent in the load order. - Added Devian.LoadMessage function for spooling post-reload messages. - Fixed a lua error caused by switching to non-existent profiles. diff -r 1b2d6d4a54fd -r d11b67d25aee Devian.lua --- a/Devian.lua Wed Apr 13 11:26:08 2016 -0400 +++ b/Devian.lua Wed Jul 06 16:30:19 2016 -0400 @@ -56,6 +56,7 @@ local D = LibStub("AceAddon-3.0"):NewAddon(D, "Devian", "AceConsole-3.0", "AceEvent-3.0") local L = D.L _G.Devian = D +_G.DevianLoadMessage = {} D:SetDefaultModuleState(false) D.oldprint = getprinthandler() if not _G.oldprint then _G.oldprint = D.oldprint end @@ -250,7 +251,7 @@ D:Print("Profile |cFFFFFF00".. list_id .."|r saved.") else - _G.DevianLoadMessage = "Switched profiles." + D.LoadMessage "Switched profiles." list_id = tonumber(mode) if list_id ~= db.main_profile then @@ -261,12 +262,17 @@ end elseif mode == nil then list_id = (db.current_profile ~= db.main_profile) and db.main_profile or db.last_profile - _G.DevianLoadMessage = "Switched between main and recent profile ("..db.current_profile..' and '..list_id..')' + D.LoadMessage ("Switched between main and recent profile ("..db.current_profile..' and '..list_id..')') db.current_profile = list_id scan_func = D.Load else return D:PrintHelp() end + + if not db.profiles[list_id] then + db.profiles[list_id] = {global = {}, char = {} } + D.LoadMessage ("Starting profile #|cFF00FFFF".. list_id..'|r') + end if not db.profiles[list_id].char[playerRealm] then db.profiles[list_id].char[playerRealm] = {} end @@ -401,6 +407,12 @@ end end +--- Queue up a message to appear after UI reload +function D.LoadMessage(msg) + + tinsert(_G.DevianLoadMessage, msg) +end + --- Creates a Devian-style output. -- The first argument describes the channel to output on, and the remaining arguments are concatenated in a manner similar to default print() -- This becomes the print handler when development mode is active. The original print() function is assigned to oldprint(). @@ -519,12 +531,12 @@ end end - _G.DevianLoadMessage = "Non-user SavedVars have been reset." + D.LoadMessage "Non-user SavedVars have been reset." _G.ReloadUI() end D.SetDefaultsAll = function () _G.DevianDB = nil - _G.DevianLoadMessage = "All SavedVars wiped." + D.LoadMessage "All SavedVars wiped." _G.ReloadUI() end @@ -568,9 +580,12 @@ self.db = db --- - if _G.DevianLoadMessage then - D:Print(_G.DevianLoadMessage) - _G.DevianLoadMessage = nil + if #_G.DevianLoadMessage >= 1 then + for i, msg in ipairs(_G.DevianLoadMessage) do + D:Print(msg) + end + + table.wipe(_G.DevianLoadMessage) end diff -r 1b2d6d4a54fd -r d11b67d25aee Devian.toc --- a/Devian.toc Wed Apr 13 11:26:08 2016 -0400 +++ b/Devian.toc Wed Jul 06 16:30:19 2016 -0400 @@ -1,5 +1,5 @@ ## Interface: 60200 -## Title: Devian +## Title: !|cFF00FFFFDevian|r ## Notes: AddOn Development Workspace ## Author: Krakyn ## Version: 2.0 @project-revision@