Software /
code /
prosody
Comparison
util/set.lua @ 5817:6e087f3b8f3b
util.set: :items() now returns an iterator instead of the underlying table. This is much more efficient than 'for item in set' (which still works for now). Current access to _items is generally done directly, this may change.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 03 Sep 2013 12:21:43 +0100 |
parent | 5814:5cf1c08805fb |
child | 5908:081a91507e4f |
comparison
equal
deleted
inserted
replaced
5814:5cf1c08805fb | 5817:6e087f3b8f3b |
---|---|
73 function set:contains(item) | 73 function set:contains(item) |
74 return items[item]; | 74 return items[item]; |
75 end | 75 end |
76 | 76 |
77 function set:items() | 77 function set:items() |
78 return items; | 78 return next, items; |
79 end | 79 end |
80 | 80 |
81 function set:remove(item) | 81 function set:remove(item) |
82 items[item] = nil; | 82 items[item] = nil; |
83 end | 83 end |