Open main menu
Home
Random
Log in
Settings
About AddOn Studio
Disclaimers
AddOn Studio
Search
Editing
WoW:USERAPI SlashCmdList AddSlashCommand
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{userfunc}} Add slash commands. SlashCmdList_AddSlashCommand(name, func, ...) == Function Parameters == === Arguments === ;name : Unique identifier (e.g. MYADDON_SLASHCMD) ;func : The function (variable or actual function) ;... : A list of commands with or without the leading slash === Returns === ; nil == Example == The following snippets do the same thing. SlashCmdList_AddSlashCommand('MYADDON_SLASHCMD', function(msg) DEFAULT_CHAT_FRAME:AddMessage(msg or 'nil') end, 'myaddon', 'ma') SlashCmdList['MYADDON_SLASHCMD'] = function(msg) DEFAULT_CHAT_FRAME:AddMessage(msg or 'nil') end SLASH_MYADDON_SLASHCMD1 = '/myaddon' SLASH_MYADDON_SLASHCMD2 = '/ma' == Code == <pre>function SlashCmdList_AddSlashCommand(name, func, ...) SlashCmdList[name] = func local command = '' for i = 1, select('#', ...) do command = select(i, ...) if strsub(command, 1, 1) ~= '/' then command = '/' .. command end _G['SLASH_'..name..i] = command end end</pre>
Summary:
Please note that all contributions to AddOn Studio are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
AddOn Studio Wiki:Copyrights
for details).
Submissions must be written by you, or copied from a public domain or similar free resource (see
AddOn Studio Wiki:Copyrights
for details).
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Apinav
(
edit
)
Template:Editlink
(
edit
)
Template:Notebox
(
edit
)
Template:Userfunc
(
edit
)