Mercurial > wow > breuesk
diff Core.lua @ 43:4109683c3172
Kept AceConsole embedded - it handily disables the chat commands when the addon is disabled
Did a little passthrough to properly set the self param for commands like Print()
author | John@Yosemite-PC |
---|---|
date | Thu, 15 Mar 2012 22:27:51 -0400 |
parents | 72055fc7e115 |
children | 8913e7d79cad |
line wrap: on
line diff
--- a/Core.lua Thu Mar 15 08:47:41 2012 -0400 +++ b/Core.lua Thu Mar 15 22:27:51 2012 -0400 @@ -22,7 +22,8 @@ local strsplit=strsplit local string=string local sformat=string.format -local bsk = LibStub("AceAddon-3.0"):NewAddon("bsk","AceConsole-3.0", "AceHook-3.0", "AceComm-3.0", "AceSerializer-3.0") +local bsk = LibStub("AceAddon-3.0"):NewAddon("bsk","AceConsole-3.0") +-- "AceHook-3.0", "AceComm-3.0", "AceSerializer-3.0" _G.bsk=bsk local L = LibStub("AceLocale-3.0"):GetLocale("bsk", false) setfenv(1,bsk) @@ -37,12 +38,22 @@ -- 4) table.remove() works ok if reverse iterating, terrible at anything else -- 5) pairs() does not have a guaranteed iteration order +-- These two functions properly format the call to AceConsole:Print(), which +-- needs a full object. Calling "Print" will call the mixed-in console functions +-- but without a self parameter because of the namespacing. I would disembed +-- console, except that it has handy OnDisable behavior to disable chat +-- commands. +function print(...) + bsk:Print(...) +end +function printf(...) + bsk:Printf(...) +end function OnInitialize() db = _G.LibStub("AceDB-3.0"):New("BskDB", defaults, "Default") - bsk:Print("Totally libstubbed a db") options.args.profile = _G.LibStub("AceDBOptions-3.0"):GetOptionsTable(db) _G.LibStub("AceConfig-3.0"):RegisterOptionsTable("bsk", options) @@ -54,7 +65,7 @@ function OnEnable() CreateWorkingStateFromChanges(db.profile.changes) - CreateGUI() + --CreateGUI() end function HandleCommand(paramIn) @@ -67,7 +78,7 @@ end if param[1] == nil or param[1] == "" then - bsk:Print("need args") + print("need args") return end if param[1] == "persons" then @@ -92,7 +103,7 @@ local person = FixPersonName(param[3]) RemovePerson(person) else - bsk:Print(sformat("Deleting anything of type %s is not supported",param[2])) + printf("Deleting anything of type %s is not supported",param[2]) end elseif param[1] == "nuke" then if param[2] == nil or param[2] == "" then