diff 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
line wrap: on
line diff
--- a/Devian.lua	Wed Jul 06 16:31:00 2016 -0400
+++ b/Devian.lua	Wed Jul 06 18:48:20 2016 -0400
@@ -3,16 +3,32 @@
 -- @project-revision@ @project-hash@
 -- @file-revision@ @file-hash@
 
---GLOBALS: Devian, DevCon, DevianLoadMessage
+--GLOBALS: Devian, DevCon, DevianLoadMessage, DEVIAN_WORKSPACE
+
 local ADDON, D = ...
+local MAJOR, MINOR = 'Devian-2.0', 'r@project-revision@'
+local D =  LibStub("AceAddon-3.0"):NewAddon(D, "Devian", "AceConsole-3.0", "AceEvent-3.0")
+local L = D.L
+Devian = D
 local sub, GetTime, print, _G = string.sub, GetTime, print, _G
 local format, setmetatable, getprinthandler, setprinthandler = string.format, setmetatable, getprinthandler, setprinthandler
-local tinsert, tremove = tinsert, tremove
+local tinsert, tremove, rawset = tinsert, tremove, rawset
 local currentProfile
 local playerName = UnitName("player")
 local playerRealm = playerName .. '-' .. GetRealmName()
 local num_dock_tabs = 0
-local in_workspace = false
+DEVIAN_WORKSPACE = false
+
+
+DevianLoadMessage = setmetatable({}, {
+  __call = function(t, msg)
+    rawset(t, #t+1, msg)
+  end,
+  __index = function(t)
+    return #t
+  end
+})
+
 --@debug@
 D.debugmode = true
 --@end-debug@
@@ -29,20 +45,6 @@
 end
 local print = D.print
 
-setmetatable(D, {
-  __call = function(t,k)
-    if not k then
-      return t.in_workspace
-    end
-
-    return function(value)
-      if value then
-        D[k] = value
-      end
-      return D[k]
-    end
-  end
-})
 D.L = setmetatable({}, {
   __index= function(t,k)
     return k
@@ -51,12 +53,6 @@
     return format((t[k] or k) , ...)
   end
 })
-
-local MAJOR, MINOR = 'Devian-2.0', 'r@project-revision@'
-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
@@ -195,8 +191,10 @@
   currentProfile = D.currentProfile
   currentProfile.char[playerRealm] = currentProfile.char[playerRealm] or {}
   if currentProfile.workspace then
+    DEVIAN_WORKSPACE = true
     setprinthandler(D.Message)
   else
+    DEVIAN_WORKSPACE = false
     print = function() end
   end