[added] set:to_table which returns the ordered contents unchanged and intentionally disables the set object itself

This commit is contained in:
Max Cahill 2020-08-24 20:54:24 +10:00
parent e957a4502f
commit 028b21ef9a

View File

@ -66,6 +66,15 @@ function set:values_readonly()
return self._ordered
end
--convert to an ordered table, destroying set-like properties
--and deliberately disabling the initial set object
function set:to_table()
local r = self._ordered
self._ordered = nil
self._keyed = nil
return r
end
--modifying operations
--add all the elements present in the other set