Software /
code /
prosody
Comparison
util/set.lua @ 1029:4ead03974759
util.set: Add set:empty() to discover if the set is the empty set
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 22 Apr 2009 18:03:02 +0100 |
parent | 1028:594a07e753a0 |
child | 1030:a82268d507fc |
comparison
equal
deleted
inserted
replaced
1028:594a07e753a0 | 1029:4ead03974759 |
---|---|
89 for item in pairs(otherset) do | 89 for item in pairs(otherset) do |
90 items[item] = nil; | 90 items[item] = nil; |
91 end | 91 end |
92 end | 92 end |
93 | 93 |
94 function set:empty() | |
95 return not next(items); | |
96 end | |
97 | |
94 if list then | 98 if list then |
95 set:add_list(list); | 99 set:add_list(list); |
96 end | 100 end |
97 | 101 |
98 return setmetatable(set, set_mt); | 102 return setmetatable(set, set_mt); |