Mercurial > prosody-hg
comparison util/set.lua @ 5813:c888f548876b
util.set: Fix :include() and :exclude() methods to iterate the input set correctly
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Mon, 02 Sep 2013 20:52:19 +0100 |
| parents | 8c5b5ebaacb0 |
| children | 5cf1c08805fb 071a7e461ae7 |
comparison
equal
deleted
inserted
replaced
| 5812:57ebf93ec720 | 5813:c888f548876b |
|---|---|
| 89 end | 89 end |
| 90 end | 90 end |
| 91 end | 91 end |
| 92 | 92 |
| 93 function set:include(otherset) | 93 function set:include(otherset) |
| 94 for item in pairs(otherset) do | 94 for item in otherset do |
| 95 items[item] = true; | 95 items[item] = true; |
| 96 end | 96 end |
| 97 end | 97 end |
| 98 | 98 |
| 99 function set:exclude(otherset) | 99 function set:exclude(otherset) |
| 100 for item in pairs(otherset) do | 100 for item in otherset do |
| 101 items[item] = nil; | 101 items[item] = nil; |
| 102 end | 102 end |
| 103 end | 103 end |
| 104 | 104 |
| 105 function set:empty() | 105 function set:empty() |
