Mercurial > wow > breuesk
comparison Lists.lua @ 21:ffcea2f51663
Delete a list
author | John@Yosemite-PC |
---|---|
date | Fri, 09 Mar 2012 23:33:46 -0500 |
parents | 3fedb912c088 |
children | 27cf1355cd6f |
comparison
equal
deleted
inserted
replaced
20:3fedb912c088 | 21:ffcea2f51663 |
---|---|
223 bsk:DoAddPerson(change) | 223 bsk:DoAddPerson(change) |
224 elseif change.action == "RenameList" then | 224 elseif change.action == "RenameList" then |
225 bsk:DoRenameList(change) | 225 bsk:DoRenameList(change) |
226 elseif change.action == "CreateList" then | 226 elseif change.action == "CreateList" then |
227 bsk:DoCreateList(change) | 227 bsk:DoCreateList(change) |
228 elseif change.action == "DeleteList" then | |
229 bsk:DoDeleteList(change) | |
228 elseif change.action == "AddToListEnd" then | 230 elseif change.action == "AddToListEnd" then |
229 bsk:DoAddPersonToListEnd(change) | 231 bsk:DoAddPersonToListEnd(change) |
230 elseif change.action == "AddToListRand" then | 232 elseif change.action == "AddToListRand" then |
231 bsk:DoAddPersonToListRandom(change) | 233 bsk:DoAddPersonToListRandom(change) |
232 elseif change.action == "SuicidePerson" then | 234 elseif change.action == "SuicidePerson" then |
467 if bsk:DoRenameList(change) then | 469 if bsk:DoRenameList(change) then |
468 bsk:CommitChange(change) | 470 bsk:CommitChange(change) |
469 end | 471 end |
470 end | 472 end |
471 | 473 |
474 function bsk:DoDeleteList(change) | |
475 bsk.lists[change.arg.listIndex] = nil | |
476 return true | |
477 end | |
478 | |
479 function bsk:DeleteList(listName) | |
480 local listIndex = bsk:GetListIndex(listName) | |
481 local change = {action="DeleteList",arg={listIndex=listIndex}} | |
482 bsk:StartChange(change) | |
483 if bsk:DoDeleteList(change) then | |
484 bsk:CommitChange(change) | |
485 end | |
486 end | |
487 | |
472 --}}} | 488 --}}} |
473 -- Higher order actions (ie calls other standard actions){{{ | 489 -- Higher order actions (ie calls other standard actions){{{ |
474 | 490 |
475 function bsk:TrimLists(time) | 491 function bsk:TrimLists(time) |
476 if not bsk:CheckListCausality() then | 492 if not bsk:CheckListCausality() then |
532 for i,v in pairs(reserveIdP) do | 548 for i,v in pairs(reserveIdP) do |
533 if v then t[i] = true end | 549 if v then t[i] = true end |
534 end | 550 end |
535 | 551 |
536 -- now remove from t all of the people already present on the list | 552 -- now remove from t all of the people already present on the list |
537 for i = 1,#list do | 553 if list then |
538 if t[list[i].id] then | 554 for i = 1,#list do |
539 t[list[i].id] = false | 555 if t[list[i].id] then |
556 t[list[i].id] = false | |
557 end | |
540 end | 558 end |
541 end | 559 end |
542 | 560 |
543 -- add all remaining | 561 -- add all remaining |
544 for i,v in pairs(t) do | 562 for i,v in pairs(t) do |