Skip to content
everloot

Lore archive · Warcraft Wiki, 2023 dump

SlashCmdList AddSlashCommand

Last wiki revision 2009-11-02

Add slash commands. SlashCmdList_AddSlashCommand(name, func, ...)

  • name : Unique identifier (e.g. MYADDON_SLASHCMD)
  • func : The function (variable or actual function)
  • ... : A list of commands with or without the leading slash
  • nil

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'

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

Source

https://warcraft.wiki.gg/wiki/SlashCmdList_AddSlashCommand · retrieved 2023-11-13 · CC BY-SA 4.0

Converted from wikitext with templates, tables and images removed, so some sentences may be missing values.

This archive predates WoW: Forever. For collected gameplay facts see the Forever database. Search the archive.