View Single Post
05-25-10, 09:24 AM   #8
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,929
Hmm, well the last 2 lines I got from your code as I assumed the slash command function was being reached.

This is how I code for slash commands if my addon name is called ScrollingWatchFrame

I am assuming that your TOC file contains KRAHLog_raidmembers as a saved variable table. Add a print("blah text") line to make sure it gets to where you want.

Code:
local function ValidateSlashCommand(msg)
       msg = string.lower(msg);
       local args = {};
       for word in string.gmatch(msg,"[^%s]+") do
            table.insert(args,word);
       end
       if ( args[1] == "delete" ) then
          print("Deleting the contents of KRAHLog_raidmembers which currently has the value of ", KRAHLog_raidmembers);
          KRAHLog_raidmembers = {}
       end
end

Code:
SLASH_ScrollingWatchFrameCmd1 = '/swf';

SlashCmdList['ScrollingWatchFrameCmd'] = ValidateSlashCommand;
That print line I added should show that you reached that part of the function and what the current value of that table is. It should say something like table:123423 which tells us it is a table whether it is empty or not.

You may have to change the yellow items to reflect your addon but that should all work the way you want. If it doesn't try the wipe(KRAHLog_raidmembers) instead and see if that works. I am doing this from memory but I do know wipe(table) works as I use it in one of my own addons.

The function converts what you type into lower case so the case is not an issue here.

With my example /swf delete should trigger the slash command test and empty the table. Simply changing the yellow items to your addons values should be enough.
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818

Last edited by Xrystal : 05-25-10 at 09:30 AM.
  Reply With Quote