Search code examples
luaworld-of-warcraft

WOW Addon commands


I'm learning about wow addons and I would like to create a command that shows in chat "Hello World" when I typed "/cht". I checked http://wowwiki.wikia.com/wiki/Creating_a_slash_command but my code does not work.

My code:

SLASH_CHAT = "/cht"
SlashCmdList["CHAT"] = function(msg)
        print("Hello World!")
end

Do you have any idea why is not working?

Thanks in advance.


Solution

  • You need to change your global from SLASH_CHAT to SLASH_CHAT1, yes it's really that simple.