Software /
code /
prosody
Comparison
util/set.lua @ 4544:316e2b09a562
util.set: Accept nil to add_list()
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 22 Jan 2012 23:59:19 +0000 |
parent | 3540:bc139431830b |
child | 4908:8c5b5ebaacb0 |
comparison
equal
deleted
inserted
replaced
4543:db27a4c18b6a | 4544:316e2b09a562 |
---|---|
80 function set:remove(item) | 80 function set:remove(item) |
81 items[item] = nil; | 81 items[item] = nil; |
82 end | 82 end |
83 | 83 |
84 function set:add_list(list) | 84 function set:add_list(list) |
85 for _, item in ipairs(list) do | 85 if list then |
86 items[item] = true; | 86 for _, item in ipairs(list) do |
87 items[item] = true; | |
88 end | |
87 end | 89 end |
88 end | 90 end |
89 | 91 |
90 function set:include(otherset) | 92 function set:include(otherset) |
91 for item in pairs(otherset) do | 93 for item in pairs(otherset) do |