util.set: Add set:empty() to discover if the set is the empty set
authorMatthew Wild <mwild1@gmail.com>
Wed, 22 Apr 2009 17:03:02 +0000 (18:03 +0100)
committerMatthew Wild <mwild1@gmail.com>
Wed, 22 Apr 2009 17:03:02 +0000 (18:03 +0100)
util/set.lua

index 892f1c9d3f70e14bc75a3d36df9ebdcd98531078..bb318adf5290a207d41c3c7f0a2144acf4dd2dcd 100644 (file)
@@ -91,6 +91,10 @@ function new(list)
                end
        end
        
+       function set:empty()
+               return not next(items);
+       end
+       
        if list then
                set:add_list(list);
        end