summaryrefslogtreecommitdiff
path: root/xmake/core/base/table.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/core/base/table.lua')
-rw-r--r--xmake/core/base/table.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/xmake/core/base/table.lua b/xmake/core/base/table.lua
index 410b4a329..3b4013232 100644
--- a/xmake/core/base/table.lua
+++ b/xmake/core/base/table.lua
@@ -280,7 +280,7 @@ function table.wrap(object)
end
-- remove repeat from the given array
-function table.unique(array)
+function table.unique(array, barrier)
-- remove repeat
if type(array) == "table" then
@@ -292,6 +292,13 @@ function table.unique(array)
local exists = {}
local unique = {}
for _, v in ipairs(array) do
+
+ -- exists barrier? clear the current existed items
+ if barrier and barrier(v) then
+ exists = {}
+ end
+
+ -- add unique item
if type(v) == "string" then
if not exists[v] then
exists[v] = true