→Stategy
(Added a note about setting the handler function to a method of an object) |
|||
| Line 9: | Line 9: | ||
An addon must create a function that would handle the slash command (possibly parsing the argument string passed to it), and place it into the SlashCmdList table. Additionally, an addon must declare which slash commands it wishes to bind to its handler function. | An addon must create a function that would handle the slash command (possibly parsing the argument string passed to it), and place it into the SlashCmdList table. Additionally, an addon must declare which slash commands it wishes to bind to its handler function. | ||
== | == Strategy == | ||
# Pick a unique identifier for the slash command: i.e. MYADDON | # Pick a unique identifier for the slash command: i.e. MYADDON | ||
#: A common convention is ADDONNAME if you only have one slash command, or ADDONNAME_COMMANDNAME if you have multiple (where ADDONNAME is the name of your addon). | #: A common convention is ADDONNAME if you only have one slash command, or ADDONNAME_COMMANDNAME if you have multiple (where ADDONNAME is the name of your addon). | ||