comparison Lists.lua @ 50:b155a875de42

Some API updates
author John@Yosemite-PC
date Wed, 21 Mar 2012 23:23:06 -0400
parents f52d472f0b0a
children 93acdcd6ace5
comparison
equal deleted inserted replaced
49:f52d472f0b0a 50:b155a875de42
114 function ListEntry:ReplaceId(newId) -- returns the old Id 114 function ListEntry:ReplaceId(newId) -- returns the old Id
115 local temp = self.id 115 local temp = self.id
116 self.id = newId 116 self.id = newId
117 return temp 117 return temp
118 end 118 end
119 function ListEntry:GetClass() -- todo: consider if this is ok
120 return PersonList:Select(self.id):GetClass()
121 end
122 function ListEntry:GetName() -- todo: consider if this is ok
123 return PersonList:Select(self.id):GetName()
124 end
119 125
120 List = 126 List =
121 { 127 {
122 name = "", 128 name = "",
123 time = 0, 129 time = 0,
241 end 247 end
242 local index = math.random() 248 local index = math.random()
243 local listIndex = self:GetId() 249 local listIndex = self:GetId()
244 return InitiateChange("InsertEntry",self,{listIndex=listIndex,id=id,roll=index}) 250 return InitiateChange("InsertEntry",self,{listIndex=listIndex,id=id,roll=index})
245 end 251 end
252 function List:GetLength()
253 return #self.data
254 end
246 function List:OrderedListEntryIter() 255 function List:OrderedListEntryIter()
247 local i = 0 256 local i = 0
248 local n = #self.data 257 local n = #self.data
249 258
250 return function() 259 return function()
380 if v == list then 389 if v == list then
381 return i 390 return i
382 end 391 end
383 end 392 end
384 end 393 end
394 -- todo: iterator for lists ... it's pretty necessary
385 395
386 Toon = 396 Toon =
387 { 397 {
388 id=0, 398 id=0,
389 name="", 399 name="",
521 -- todo: check that they're not already reserved 531 -- todo: check that they're not already reserved
522 self.active.reserve[le:GetId()] = true 532 self.active.reserve[le:GetId()] = true
523 end 533 end
524 end 534 end
525 -- todo: remove reserve 535 -- todo: remove reserve
526 function PersonList:IsActive(id) 536 function PersonList:IsActive(id) -- todo: support LE as input - saves IsActive(le:GetId())
527 return self.active.raid[id] or self.active.reserve[id] 537 return self.active.raid[id] or self.active.reserve[id]
528 end 538 end
529 function PersonList:AddMissing() 539 function PersonList:AddMissing()
530 self:RefreshRaidList() 540 self:RefreshRaidList()
531 for _,name in pairs(self.active.raidExtras) do 541 for _,name in pairs(self.active.raidExtras) do