summaryrefslogtreecommitdiff
path: root/xmake/core/base/table.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-11-10 00:55:02 +0800
committerruki <[email protected]>2017-11-09 23:30:16 +0800
commitfffaaa614f5c3098f309fce4e7e6342659e5817f (patch)
treef7d9fa7bfc37ca3e906c9696a7abbe9e5cf2f783 /xmake/core/base/table.lua
parentaa332adff92a4d51ec02b884276cded3ba9ec83c (diff)
add del_files() api
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