View Single Post
09-30-07, 08:08 AM   #2
mulesh
A Chromatic Dragonspawn
 
mulesh's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 193
This will handle two variables entered for a command.

Code:
function GmTool_OnLoad()
SlashCmdList["GMTOOL"] = GmTool_perso_Slash;
SLASH_GMTOOL1 = "/gt";
end

function GmTool_perso_Slash(msg)
    local Cmd, Sub = GmTool_GetCmd(msg);
    if (Cmd and Sub) then
        DEFAULT_CHAT_FRAME:AddMessage(Cmd);
        DEFAULT_CHAT_FRAME:AddMessage(Sub);
    end
end

function GmTool_GetCmd(msg)
    if (msg) then
        local a,b,c=strfind(msg, "(%S+)");
        if a then
            return c, strsub(msg, b+2);
        else
            return "";
        end
    end
end
__________________
"Don"t tase me bro!" ~ Andrew Meyer