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
parent 4908:8c5b5ebaacb0
child 5814:5cf1c08805fb
child 5906: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()