1
0
Fork 0

core functionality: RegisterSlashCommand

This commit is contained in:
pigmonkey 2011-05-30 14:57:41 -04:00
parent b5ace77c95
commit 0bd08158bb
2 changed files with 42 additions and 7 deletions

View File

@ -17,18 +17,19 @@ local options = {
},
}
local slashCallback = {}
function core:OnInitialize()
self.db = LibStub("AceDB-3.0"):New("AllTheLittleThingsDB", defaults, "Default")
-- self:RegisterChatCommand("atlt", function() end)
self:RegisterChatCommand("atlt", "MainSlashHandle")
-- LibStub("AceConfigRegistry-3.0"):RegisterOptionsTable("AllTheLittleThings", options)
-- local ACD = LibStub("AceConfigDialog-3.0")
-- ACD:AddToBlizOptions("AllTheLittleThings", "AllTheLittleThings")
self:SetDefaultModulePrototype({
OnEnable = function(self)
end,
RegisterOptions = core.RegisterOptions,
RegisterSlashCommand = core.RegisterSlashCommand,
})
end
@ -40,8 +41,9 @@ function core:OnDisable()
end
function core:RegisterOptions(module, options, defaults)
local name = module:GetName()
-- two registry functions called with self=mod
function core:RegisterOptions(options, defaults)
local name = self:GetName()
defaults.profile[name] = defaults
options.args[name] = {
name = name,
@ -50,3 +52,20 @@ function core:RegisterOptions(module, options, defaults)
}
end
function core:RegisterSlashCommand(callback, ...)
for i=1,select('#', ...) do
slashCallback[select('i', ...)] = self[callback]
end
end
function core:MainSlashHandle(msg)
local _, e, command = string.find("(%S+)", msg)
msg = string.sub(msg, e+1)
if command and slashCallback[command] then
slashCallback[command](msg)
else
-- print all commands
end
end

View File

@ -15,6 +15,22 @@ Libs\AceConsole-3.0\AceConsole-3.0.xml
Libs\AceConfig-3.0\AceConfig-3.0.xml
Libs\AceTimer-3.0\AceTimer-3.0.xml
transitive.lua
# transitive.lua
# PriorityQueue.lua
AllTheLittleThings.lua
PriorityQueue.lua
modules\announce.lua
modules\battlegrounds.lua
modules\chatfilter.lua
modules\defaultui.lua
# modules\deprecated.lua
modules\guildroster.lua
modules\macros.lua
modules\miscellaneous.lua
modules\potions.lua
modules\prat.lua
modules\raid.lua
modules\rbs.lua
modules\template.lua