View Single Post
02-24-09, 06:19 PM   #1
Hati-EK
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 20
Expanding tables with loops

I have a simple question ... my current test code (tested in Wowlua and Omnibus, both times the same error) seems to have a bug - but i am unable to get it ...


Error Message: attempt to index field '?' ( a nil value )

Testcode:
Code:
local x = {}
local k = 1

while name~=nil do
   local name,rank,rankIndex,level,LOclass,zone,_,_,online,status,englishClass =GetGuildRosterInfo(k)
   x[k].n="Test"
   x[k].r=rank
   x[k].l=level
   x[k].c=LOclass
   x[k].z=zone
   x[k].on=online
   x[k].realClass=englishClass
   k=k+1
end

DEFAULT_CHAT_FRAME:AddMessage(x[1].n)
hope someone can enlight me
  Reply With Quote