Mercurial > wow > devian
comparison Devian.lua @ 79:94abbdec03fa v2.1.80
- Fixed AceConsole message mangling
| author | Nenue |
|---|---|
| date | Wed, 06 Jul 2016 18:48:20 -0400 |
| parents | d11b67d25aee |
| children | c85459c5bb16 |
comparison
equal
deleted
inserted
replaced
| 78:55ddf3655cb3 | 79:94abbdec03fa |
|---|---|
| 1 --- Devian - Devian.lua | 1 --- Devian - Devian.lua |
| 2 -- @file-author@ | 2 -- @file-author@ |
| 3 -- @project-revision@ @project-hash@ | 3 -- @project-revision@ @project-hash@ |
| 4 -- @file-revision@ @file-hash@ | 4 -- @file-revision@ @file-hash@ |
| 5 | 5 |
| 6 --GLOBALS: Devian, DevCon, DevianLoadMessage | 6 --GLOBALS: Devian, DevCon, DevianLoadMessage, DEVIAN_WORKSPACE |
| 7 | |
| 7 local ADDON, D = ... | 8 local ADDON, D = ... |
| 9 local MAJOR, MINOR = 'Devian-2.0', 'r@project-revision@' | |
| 10 local D = LibStub("AceAddon-3.0"):NewAddon(D, "Devian", "AceConsole-3.0", "AceEvent-3.0") | |
| 11 local L = D.L | |
| 12 Devian = D | |
| 8 local sub, GetTime, print, _G = string.sub, GetTime, print, _G | 13 local sub, GetTime, print, _G = string.sub, GetTime, print, _G |
| 9 local format, setmetatable, getprinthandler, setprinthandler = string.format, setmetatable, getprinthandler, setprinthandler | 14 local format, setmetatable, getprinthandler, setprinthandler = string.format, setmetatable, getprinthandler, setprinthandler |
| 10 local tinsert, tremove = tinsert, tremove | 15 local tinsert, tremove, rawset = tinsert, tremove, rawset |
| 11 local currentProfile | 16 local currentProfile |
| 12 local playerName = UnitName("player") | 17 local playerName = UnitName("player") |
| 13 local playerRealm = playerName .. '-' .. GetRealmName() | 18 local playerRealm = playerName .. '-' .. GetRealmName() |
| 14 local num_dock_tabs = 0 | 19 local num_dock_tabs = 0 |
| 15 local in_workspace = false | 20 DEVIAN_WORKSPACE = false |
| 21 | |
| 22 | |
| 23 DevianLoadMessage = setmetatable({}, { | |
| 24 __call = function(t, msg) | |
| 25 rawset(t, #t+1, msg) | |
| 26 end, | |
| 27 __index = function(t) | |
| 28 return #t | |
| 29 end | |
| 30 }) | |
| 31 | |
| 16 --@debug@ | 32 --@debug@ |
| 17 D.debugmode = true | 33 D.debugmode = true |
| 18 --@end-debug@ | 34 --@end-debug@ |
| 19 D.print = function(...) | 35 D.print = function(...) |
| 20 if currentProfile and not currentProfile.workspace then | 36 if currentProfile and not currentProfile.workspace then |
| 27 return function() end | 43 return function() end |
| 28 end | 44 end |
| 29 end | 45 end |
| 30 local print = D.print | 46 local print = D.print |
| 31 | 47 |
| 32 setmetatable(D, { | |
| 33 __call = function(t,k) | |
| 34 if not k then | |
| 35 return t.in_workspace | |
| 36 end | |
| 37 | |
| 38 return function(value) | |
| 39 if value then | |
| 40 D[k] = value | |
| 41 end | |
| 42 return D[k] | |
| 43 end | |
| 44 end | |
| 45 }) | |
| 46 D.L = setmetatable({}, { | 48 D.L = setmetatable({}, { |
| 47 __index= function(t,k) | 49 __index= function(t,k) |
| 48 return k | 50 return k |
| 49 end, | 51 end, |
| 50 __call = function(t,k,...) | 52 __call = function(t,k,...) |
| 51 return format((t[k] or k) , ...) | 53 return format((t[k] or k) , ...) |
| 52 end | 54 end |
| 53 }) | 55 }) |
| 54 | |
| 55 local MAJOR, MINOR = 'Devian-2.0', 'r@project-revision@' | |
| 56 local D = LibStub("AceAddon-3.0"):NewAddon(D, "Devian", "AceConsole-3.0", "AceEvent-3.0") | |
| 57 local L = D.L | |
| 58 _G.Devian = D | |
| 59 _G.DevianLoadMessage = {} | |
| 60 D:SetDefaultModuleState(false) | 56 D:SetDefaultModuleState(false) |
| 61 D.oldprint = getprinthandler() | 57 D.oldprint = getprinthandler() |
| 62 if not _G.oldprint then _G.oldprint = D.oldprint end | 58 if not _G.oldprint then _G.oldprint = D.oldprint end |
| 63 | 59 |
| 64 local pairs, tostring, tonumber, ipairs, type = pairs, tostring, tonumber, ipairs, type | 60 local pairs, tostring, tonumber, ipairs, type = pairs, tostring, tonumber, ipairs, type |
| 193 | 189 |
| 194 D.currentProfile = db.profiles[id] | 190 D.currentProfile = db.profiles[id] |
| 195 currentProfile = D.currentProfile | 191 currentProfile = D.currentProfile |
| 196 currentProfile.char[playerRealm] = currentProfile.char[playerRealm] or {} | 192 currentProfile.char[playerRealm] = currentProfile.char[playerRealm] or {} |
| 197 if currentProfile.workspace then | 193 if currentProfile.workspace then |
| 194 DEVIAN_WORKSPACE = true | |
| 198 setprinthandler(D.Message) | 195 setprinthandler(D.Message) |
| 199 else | 196 else |
| 197 DEVIAN_WORKSPACE = false | |
| 200 print = function() end | 198 print = function() end |
| 201 end | 199 end |
| 202 | 200 |
| 203 D.unlisted = currentProfile.unlisted | 201 D.unlisted = currentProfile.unlisted |
| 204 D.channels = currentProfile.channels | 202 D.channels = currentProfile.channels |
