Mercurial > wow > itemauditor
comparison Modules/Options.lua @ 3:bbcf81868171
Code cleanup.
| author | Asa Ayers <Asa.Ayers@Gmail.com> |
|---|---|
| date | Sat, 22 May 2010 11:34:19 -0700 |
| parents | |
| children | bbba2fae0f69 |
comparison
equal
deleted
inserted
replaced
| 2:e9a1646beaa4 | 3:bbcf81868171 |
|---|---|
| 1 local addonName, addonTable = ...; | |
| 2 local addon = _G[addonName] | |
| 3 | |
| 4 local utils = addonTable.utils | |
| 5 | |
| 6 local options = { | |
| 7 name = "ItemAuditor", | |
| 8 handler = addon, | |
| 9 type = 'group', | |
| 10 args = { | |
| 11 debug = { | |
| 12 type = "toggle", | |
| 13 name = "Debug", | |
| 14 desc = "Toggles debug messages in chat", | |
| 15 handler = utils, | |
| 16 get = "GetDebug", | |
| 17 set = "SetDebug" | |
| 18 }, | |
| 19 dump = { | |
| 20 type = "execute", | |
| 21 name = "dump", | |
| 22 desc = "dumps IA database", | |
| 23 func = "DumpInfo", | |
| 24 }, | |
| 25 options = { | |
| 26 type = "execute", | |
| 27 name = "options", | |
| 28 desc = "Show Blizzard's options GUI", | |
| 29 func = "ShowOptionsGUI", | |
| 30 guiHidden = true, | |
| 31 }, | |
| 32 }, | |
| 33 } | |
| 34 | |
| 35 function addon:RegisterOptions() | |
| 36 self.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("ItemAuditor", "ItemAuditor") | |
| 37 LibStub("AceConfig-3.0"):RegisterOptionsTable("ItemAuditor", options, {"ia"}) | |
| 38 end | |
| 39 | |
| 40 function addon:DumpInfo() | |
| 41 self:Print("self.db.char") | |
| 42 DevTools_Dump(self.db.char) | |
| 43 self:Print("self.db.factionrealm") | |
| 44 DevTools_Dump(self.db.factionrealm) | |
| 45 end | |
| 46 | |
| 47 function addon:ShowOptionsGUI() | |
| 48 InterfaceOptionsFrame_OpenToCategory(self.optionsFrame) | |
| 49 end | |
| 50 | |
| 51 function addon:GetDebug(info) | |
| 52 return self.db.char.debug | |
| 53 end | |
| 54 | |
| 55 function addon:SetDebug(info, input) | |
| 56 self.db.char.debug = input | |
| 57 local value = "off" | |
| 58 if input then | |
| 59 value = "on" | |
| 60 end | |
| 61 self:Print("Debugging is now: " .. value) | |
| 62 end |
