Thread Tools Display Modes
Prev Previous Post   Next Post Next
06-08-12, 04:35 PM   #1
rx12network
A Murloc Raider
 
rx12network's Avatar
Join Date: Jun 2012
Posts: 4
Help with Table

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
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Help with Table


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off