View Single Post
02-24-09, 06:51 PM   #2
DreamStorm
A Deviate Faerie Dragon
 
DreamStorm's Avatar
Join Date: Feb 2009
Posts: 15
I am kind of new to this lua game myself, so apologies if I am a little off the mark ....

I am assuming that you wish to create the data in the table from the returns from the GetGuildRosterInfo() method. Your while loop is set to test the name part of the return but you haven't got a value for that before you enter the loop; at least not the value you wish. As it is the while loop is essentially evaluating a global variable for nil value. I don't know if there is a global variable called name but if there isn't you're loop will never start as if will only do so if the value is not (~=) nil.

I think you would need to run that method outside the loop, then enter it, set the values and within the loop (at the end) rerun the method. I am not sure how lua handles reusing the varables in this way though. Something like ...

Code:
local x = {}
local k = 1

local name,rank,rankIndex,level,LOclass,zone,_,_,online,status,englishClass =GetGuildRosterInfo(k)
while name~=nil do
   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   
   name,rank,rankIndex,level,LOclass,zone,_,_,online,status,englishClass =GetGuildRosterInfo(k)
end

DEFAULT_CHAT_FRAME:AddMessage(x[1].n)
You may have to give the returns from the method more specific global names rather than declare them local. Please someone correct me if I am wrong.
__________________


ultima ratio regum
  Reply With Quote