Heyho,
i just try to beginn with lua.. but got my first problem... i try to make a table with indexes. i think you will know what i mean when you read the code below..
my problem is that the table will fill up in the loop (its ok) but he write just one line and overwrite it again again and again bla...
maybe someone can tell me how to work with auto-adding-rows in the loop.
P.s. sry for my bad eng - im german
Code:
Code:
ChatFrame1:AddMessage("----------------"); -- make seperator
for i=1,GetNumRaidMembers() do
local name, rang, grp, lvl, klasse, class, zone, online, tot = GetRaidRosterInfo(i); -- read raidinfos
if type(charinfo) ~= "table" then --check tableexist
-- MAKE LIST with standart values if not exist
charinfo = {}
charinfo.cname = 1;
charinfo.crang = 1;
charinfo.cvisit = 0;
charinfo.czone = 1;
else --otherwise
if charinfo.cvisit ~= nil then --check if player meeted befor
charinfo.cname = name; --fill db with values
charinfo.crang = rang;
charinfo.cvisit = 1;
charinfo.czone = zone;
print(charinfo.czone, charinfo.cname, charinfo.cvisit) --check
ChatFrame1:AddMessage("Noch keine Begegnungen mit ".. charinfo.cname ..""); --chatmessage no visits befor
else
ChatFrame1:AddMessage("B: " .. charinfo.cname .. "| " .. charinfo.cvisit) -if visited chatmessage how often
end
end
end
thanks