View Single Post
05-24-10, 08:49 PM   #1
Sinaris
A Wyrmkin Dreamwalker
 
Sinaris's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 55
Another Slash Command

Sorry for my bad english in this post, but i am a german guy. So i hope you will understand me :9

Okay. Here is my addon:


krahlog.lua

Code:
local function klog(args)

if type(KRAHLog_raidmembers) ~= "table" then
	KRAHLog_raidmembers = {}
end

local timestamp = date("%d.%m.%y %H:%M:%S")
local timestampLog = date("%m/%d/%y")

KRAHLog_raidmembers[timestamp] = {}

	for i=1, 40 do
		if UnitExists("raid"..i) then
			local LogPlayerID = i;
			local LogDate = timestampLog;
			local LogUnitClass = UnitClass("raid" .. i);
			local LogUnitName = UnitName("raid" .. i);
			--local _, LogUinitRace = UnitRace("raid" .. i);

			KRAHLog_raidmembers[timestamp][i] = LogPlayerID .." ".. LogDate .." ".. LogUnitClass .." ".. LogUnitName
		end
	end
end


SlashCmdList["SaveRaidMembers_SlashCommand"] = klog
SLASH_SaveRaidMembers_SlashCommand1 = "/klog"

And the saved variables looks like:

Code:
KRAHLog_raidmembers = {
    "1 12/5/2010 Mage Sinaris", --[1]
}
So my question is, is there any way do add another slashcommand to clean up the saved variables?
I have do delete it by hand, and that is not in my opinion

I have to:

Code:
"/klog save"
to save the current raid player in the saved variables


Code:
"klog delete"
cleans up the saved variables like this:

Code:
KRAHLog_raidmembers = {
}
i am not a pro in lua. So i hope you can help me.
  Reply With Quote