WoW:USERAPI SlashCmdList AddSlashCommand: Difference between revisions

m
Move page script moved page USERAPI SlashCmdList AddSlashCommand to WoW:USERAPI SlashCmdList AddSlashCommand without leaving a redirect
m (New page: {{userfunc}} <!-- Leave this line in! --> Returns the scaled position of the cursor. SlashCmdList_AddSlashCommand(name, func, ...) == Function Parameters == === Arguments === ;name : Un...)
 
m (Move page script moved page USERAPI SlashCmdList AddSlashCommand to WoW:USERAPI SlashCmdList AddSlashCommand without leaving a redirect)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{userfunc}} <!-- Leave this line in! -->
{{userfunc}}
 
Add slash commands.
Add slash commands.
  SlashCmdList_AddSlashCommand(name, func, ...)
  SlashCmdList_AddSlashCommand(name, func, ...)
Line 6: Line 5:
== Function Parameters ==
== Function Parameters ==
=== Arguments ===
=== Arguments ===
;name : Unique itentifier (e.g. MYADDON_SLASHCMD)
;name : Unique identifier (e.g. MYADDON_SLASHCMD)
;func : The function (variable or actual function)
;func : The function (variable or actual function)
;... : A list of commands with or without the leading slash
;... : A list of commands with or without the leading slash
Line 13: Line 12:


== Example ==
== Example ==
The following snipits do the same thing.
The following snippets do the same thing.
  SlashCmdList_AddSlashCommand('MYADDON_SLASHCMD', function(msg)
  SlashCmdList_AddSlashCommand('MYADDON_SLASHCMD', function(msg)
     DEFAULT_CHAT_FRAME:AddMessage(msg or 'nil')
     DEFAULT_CHAT_FRAME:AddMessage(msg or 'nil')
Line 24: Line 23:
  SLASH_MYADDON_SLASHCMD2 = '/ma'
  SLASH_MYADDON_SLASHCMD2 = '/ma'


==Code==
== Code ==
<pre>function SlashCmdList_AddSlashCommand(name, func, ...)
<pre>function SlashCmdList_AddSlashCommand(name, func, ...)
     SlashCmdList[name] = func
     SlashCmdList[name] = func
Line 36: Line 35:
     end
     end
end</pre>
end</pre>
__NOTOC__
Anonymous user