comparison Lists.lua @ 28:eb3a3f69559e

Command to remove person Disallow removing someone who is still on a list somewhere
author John@Yosemite-PC
date Sun, 11 Mar 2012 17:27:31 -0400
parents 611808dbc0c0
children 731182d55b6c
comparison
equal deleted inserted replaced
27:611808dbc0c0 28:eb3a3f69559e
420 local id = personName2id[name] 420 local id = personName2id[name]
421 if not id then 421 if not id then
422 bsk:Print(sformat("%s is not in the persons list, please check your spelling", name)) 422 bsk:Print(sformat("%s is not in the persons list, please check your spelling", name))
423 return false 423 return false
424 end 424 end
425 local listsTheyreOn = {}
426 -- check if they're active on any loot list
427 for i,v in pairs(bsk.lists) do
428 for x,y in ipairs(v) do
429 if y.id == id then
430 tinsert(listsTheyreOn,v.name)
431 break
432 end
433 end
434 end
435 if getn(listsTheyreOn) > 0 then
436 self:Print(sformat("Cannot remove person %s because they are on one or more lists (%s)",name,table.concat(listsTheyreOn,", ")))
437 return false
438 end
425 local change = {action="RemovePerson",arg={id=id}} 439 local change = {action="RemovePerson",arg={id=id}}
426 bsk:StartChange(change) 440 bsk:StartChange(change)
427 if bsk:DoRemovePerson() then 441 if bsk:DoRemovePerson(change) then
428 bsk:CommitChange(change) 442 bsk:CommitChange(change)
429 end 443 end
430 end--}}} 444 end--}}}
431 function bsk:DoSuicidePerson(change)--{{{ 445 function bsk:DoSuicidePerson(change)--{{{
432 local list = bsk.lists[change.arg.listIndex] 446 local list = bsk.lists[change.arg.listIndex]