xxxxxxxxxx
==Code==
-- returns a slash command function on success or an ''informative'' error function on failure.
local function GetSlashFunc(cmd)
if not cmd then
return function(cmd) print("You must supply a command.") end
end
if cmd:sub(1, 1) ~= "/" then
cmd = "/" .. cmd
for id, val in pairs(_G) do
if id:sub(1, 5) == "SLASH" and val == cmd then
local slashID = id:match("SLASH_(%a*)%d*")
return SlashCmdList[slashID]
-- Didn't find one?
return function(cmd) print(cmd, "doesn't exist.") end