WoWInterface SVN Broadcaster

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk/Broadcaster/Libs/AceConsole-3.0
    from Rev 2 to Rev 16
    Reverse comparison

Rev 2 → Rev 16

AceConsole-3.0.lua
1,5 → 1,5
--[[ $Id: AceConsole-3.0.lua 63886 2008-03-08 12:43:31Z nevcairiel $ ]]
local MAJOR,MINOR = "AceConsole-3.0", 4
--[[ $Id: AceConsole-3.0.lua 74633 2008-05-21 08:20:50Z nevcairiel $ ]]
local MAJOR,MINOR = "AceConsole-3.0", 6
 
local AceConsole, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
 
45,21 → 45,15
-- command (string) - chat command to be registered WITHOUT leading "/"
-- func (function|membername) - function to call, or self[membername](self, ...) call
-- persist (boolean) - false: the command will be soft disabled/enabled when aceconsole is used as a mixin (default: true)
-- silent (boolean) - don't whine if command already exists, silently fail
--
-- Register a simple chat command
function AceConsole:RegisterChatCommand( command, func, persist, silent )
if type(command)~="string" then error([[Usage: AceConsole:RegisterChatCommand( "command", func[, persist[, silent] ]): 'command' - expected a string]], 2) end
function AceConsole:RegisterChatCommand( command, func, persist )
if type(command)~="string" then error([[Usage: AceConsole:RegisterChatCommand( "command", func[, persist ]): 'command' - expected a string]], 2) end
 
if persist==nil then persist=true end -- I'd rather have my addon's "/addon enable" around if the author screws up. Having some extra slash regged when it shouldnt be isn't as destructive. True is a better default. /Mikk
 
local name = "ACECONSOLE_"..command:upper()
if SlashCmdList[name] then
if not silent then
geterrorhandler()(tostring(self)..": Chat Command '"..command.."' already exists, will not overwrite.")
end
return
end
 
if type( func ) == "string" then
SlashCmdList[name] = function(input)
self[func](self, input)