From e0f3b050fbcee8e950f56274bb5ab6d228056b97 Mon Sep 17 00:00:00 2001 From: James Whitehead II Date: Wed, 1 Dec 2010 16:37:59 +0000 Subject: [PATCH] Update AddonCore to re-include Printf --- AddonCore.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/AddonCore.lua b/AddonCore.lua index d524340..a765133 100644 --- a/AddonCore.lua +++ b/AddonCore.lua @@ -52,6 +52,22 @@ if EMERGENCY_DEBUG then end --[[------------------------------------------------------------------------- +-- Print/Printf support +-------------------------------------------------------------------------]]-- + +local printHeader = "|cFF33FF99%s|r: " + +function addon:Printf(msg, ...) + msg = printHeader .. msg + local success, txt = pcall(string.format, msg, addonName, ...) + if success then + print(txt) + else + error(string.gsub(txt, "'%?'", string.format("'%s'", "Printf")), 3) + end +end + +--[[------------------------------------------------------------------------- -- Event registration and dispatch -------------------------------------------------------------------------]]-- -- 1.7.9.5