Mercurial > wow > itemauditor
comparison Libs/AceConfig-3.0/AceConfig-3.0.lua @ 0:169f5211fc7f
First public revision.
At this point ItemAuditor watches mail for auctions sold or purchased, watches for buy/sell (money and 1 item type change) and conversions/tradeskills. Milling isn't working yet because there is too much time between the first event and the last event.
| author | Asa Ayers <Asa.Ayers@Gmail.com> |
|---|---|
| date | Thu, 20 May 2010 19:22:19 -0700 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:169f5211fc7f |
|---|---|
| 1 --- AceConfig-3.0 wrapper library. | |
| 2 -- Provides an API to register an options table with the config registry, | |
| 3 -- as well as associate it with a slash command. | |
| 4 -- @class file | |
| 5 -- @name AceConfig-3.0 | |
| 6 -- @release $Id: AceConfig-3.0.lua 877 2009-11-02 15:56:50Z nevcairiel $ | |
| 7 | |
| 8 --[[ | |
| 9 AceConfig-3.0 | |
| 10 | |
| 11 Very light wrapper library that combines all the AceConfig subcomponents into one more easily used whole. | |
| 12 | |
| 13 ]] | |
| 14 | |
| 15 local MAJOR, MINOR = "AceConfig-3.0", 2 | |
| 16 local AceConfig = LibStub:NewLibrary(MAJOR, MINOR) | |
| 17 | |
| 18 if not AceConfig then return end | |
| 19 | |
| 20 local cfgreg = LibStub("AceConfigRegistry-3.0") | |
| 21 local cfgcmd = LibStub("AceConfigCmd-3.0") | |
| 22 local cfgdlg = LibStub("AceConfigDialog-3.0") | |
| 23 --TODO: local cfgdrp = LibStub("AceConfigDropdown-3.0") | |
| 24 | |
| 25 -- Lua APIs | |
| 26 local pcall, error, type, pairs = pcall, error, type, pairs | |
| 27 | |
| 28 -- ------------------------------------------------------------------- | |
| 29 -- :RegisterOptionsTable(appName, options, slashcmd, persist) | |
| 30 -- | |
| 31 -- - appName - (string) application name | |
| 32 -- - options - table or function ref, see AceConfigRegistry | |
| 33 -- - slashcmd - slash command (string) or table with commands, or nil to NOT create a slash command | |
| 34 | |
| 35 --- Register a option table with the AceConfig registry. | |
| 36 -- You can supply a slash command (or a table of slash commands) to register with AceConfigCmd directly. | |
| 37 -- @paramsig appName, options [, slashcmd] | |
| 38 -- @param appName The application name for the config table. | |
| 39 -- @param options The option table (or a function to generate one on demand) | |
| 40 -- @param slashcmd A slash command to register for the option table, or a table of slash commands. | |
| 41 -- @usage | |
| 42 -- local AceConfig = LibStub("AceConfig-3.0") | |
| 43 -- AceConfig:RegisterOptionsTable("MyAddon", myOptions, {"/myslash", "/my"}) | |
| 44 function AceConfig:RegisterOptionsTable(appName, options, slashcmd) | |
| 45 local ok,msg = pcall(cfgreg.RegisterOptionsTable, self, appName, options) | |
| 46 if not ok then error(msg, 2) end | |
| 47 | |
| 48 if slashcmd then | |
| 49 if type(slashcmd) == "table" then | |
| 50 for _,cmd in pairs(slashcmd) do | |
| 51 cfgcmd:CreateChatCommand(cmd, appName) | |
| 52 end | |
| 53 else | |
| 54 cfgcmd:CreateChatCommand(slashcmd, appName) | |
| 55 end | |
| 56 end | |
| 57 end |
