annotate Libs/AceConfig-3.0/AceConfig-3.0.lua @ 6:f10c8a083d2a

The ALPHA help request popup should pop when the addon is enabled for every 15th time. I really would like some data to. The timer to start opening mail when you open the mailbox will now use the initial mail opening delay.
author Zerotorescue
date Wed, 08 Sep 2010 00:48:37 +0200
parents 823e33465b6e
children
rev   line source
Zerotorescue@0 1 --- AceConfig-3.0 wrapper library.
Zerotorescue@0 2 -- Provides an API to register an options table with the config registry,
Zerotorescue@0 3 -- as well as associate it with a slash command.
Zerotorescue@0 4 -- @class file
Zerotorescue@0 5 -- @name AceConfig-3.0
Zerotorescue@0 6 -- @release $Id: AceConfig-3.0.lua 877 2009-11-02 15:56:50Z nevcairiel $
Zerotorescue@0 7
Zerotorescue@0 8 --[[
Zerotorescue@0 9 AceConfig-3.0
Zerotorescue@0 10
Zerotorescue@0 11 Very light wrapper library that combines all the AceConfig subcomponents into one more easily used whole.
Zerotorescue@0 12
Zerotorescue@0 13 ]]
Zerotorescue@0 14
Zerotorescue@0 15 local MAJOR, MINOR = "AceConfig-3.0", 2
Zerotorescue@0 16 local AceConfig = LibStub:NewLibrary(MAJOR, MINOR)
Zerotorescue@0 17
Zerotorescue@0 18 if not AceConfig then return end
Zerotorescue@0 19
Zerotorescue@0 20 local cfgreg = LibStub("AceConfigRegistry-3.0")
Zerotorescue@0 21 local cfgcmd = LibStub("AceConfigCmd-3.0")
Zerotorescue@0 22 local cfgdlg = LibStub("AceConfigDialog-3.0")
Zerotorescue@0 23 --TODO: local cfgdrp = LibStub("AceConfigDropdown-3.0")
Zerotorescue@0 24
Zerotorescue@0 25 -- Lua APIs
Zerotorescue@0 26 local pcall, error, type, pairs = pcall, error, type, pairs
Zerotorescue@0 27
Zerotorescue@0 28 -- -------------------------------------------------------------------
Zerotorescue@0 29 -- :RegisterOptionsTable(appName, options, slashcmd, persist)
Zerotorescue@0 30 --
Zerotorescue@0 31 -- - appName - (string) application name
Zerotorescue@0 32 -- - options - table or function ref, see AceConfigRegistry
Zerotorescue@0 33 -- - slashcmd - slash command (string) or table with commands, or nil to NOT create a slash command
Zerotorescue@0 34
Zerotorescue@0 35 --- Register a option table with the AceConfig registry.
Zerotorescue@0 36 -- You can supply a slash command (or a table of slash commands) to register with AceConfigCmd directly.
Zerotorescue@0 37 -- @paramsig appName, options [, slashcmd]
Zerotorescue@0 38 -- @param appName The application name for the config table.
Zerotorescue@0 39 -- @param options The option table (or a function to generate one on demand)
Zerotorescue@0 40 -- @param slashcmd A slash command to register for the option table, or a table of slash commands.
Zerotorescue@0 41 -- @usage
Zerotorescue@0 42 -- local AceConfig = LibStub("AceConfig-3.0")
Zerotorescue@0 43 -- AceConfig:RegisterOptionsTable("MyAddon", myOptions, {"/myslash", "/my"})
Zerotorescue@0 44 function AceConfig:RegisterOptionsTable(appName, options, slashcmd)
Zerotorescue@0 45 local ok,msg = pcall(cfgreg.RegisterOptionsTable, self, appName, options)
Zerotorescue@0 46 if not ok then error(msg, 2) end
Zerotorescue@0 47
Zerotorescue@0 48 if slashcmd then
Zerotorescue@0 49 if type(slashcmd) == "table" then
Zerotorescue@0 50 for _,cmd in pairs(slashcmd) do
Zerotorescue@0 51 cfgcmd:CreateChatCommand(cmd, appName)
Zerotorescue@0 52 end
Zerotorescue@0 53 else
Zerotorescue@0 54 cfgcmd:CreateChatCommand(slashcmd, appName)
Zerotorescue@0 55 end
Zerotorescue@0 56 end
Zerotorescue@0 57 end