Created
November 13, 2020 15:52
-
-
Save kemayo/e3a9c7ec2bf703c152933de10b65412a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local myname, addon = ... | |
local TextDump = LibStub("LibTextDump-1.0") | |
addon.debuggable = GetAddOnMetadata(myname, "Version") == '@project-version@' | |
local _window | |
local function GetDebugWindow() | |
if not _window then | |
_window = TextDump:New(myname) | |
end | |
return _window | |
end | |
addon.GetDebugWindow = GetDebugWindow | |
addon.Debug = function(...) | |
if not addon.debuggable then return end | |
-- if debugf then debugf:AddMessage(string.join(", ", tostringall(...))) end | |
GetDebugWindow():AddLine(string.join(', ', tostringall(...))) | |
end | |
addon.DebugF = function(...) | |
if not addon.debuggable then return end | |
Debug(string.format(...)) | |
end | |
function addon:ShowDebugWindow() | |
local window = self.GetDebugWindow() | |
if window:Lines() == 0 then | |
window:AddLine("Nothing has happened yet") | |
window:Display() | |
window:Clear() | |
return | |
end | |
window:Display() | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment