summaryrefslogtreecommitdiff
path: root/xmake/core/sandbox/modules/pairs.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2016-09-01 14:00:04 +0800
committerruki <[email protected]>2016-09-01 14:00:04 +0800
commit0783aa7d6de42ea14b2da12f1bfdcd0711fb7f99 (patch)
treecf9d25283da3e2a1f6b47903c44be9403edac41a /xmake/core/sandbox/modules/pairs.lua
parent98041add2635b07c13f6016cf2c2f6e8aa81e8db (diff)
fix pairs filter bug
Diffstat (limited to 'xmake/core/sandbox/modules/pairs.lua')
-rw-r--r--xmake/core/sandbox/modules/pairs.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/xmake/core/sandbox/modules/pairs.lua b/xmake/core/sandbox/modules/pairs.lua
index d8adb98ef..17e6fd952 100644
--- a/xmake/core/sandbox/modules/pairs.lua
+++ b/xmake/core/sandbox/modules/pairs.lua
@@ -47,11 +47,14 @@ local table = require("base/table")
--
function sandbox_pairs(t, filter, ...)
+ -- has filter?
+ local has_filter = type(filter) == "function"
+
-- init iterator
local args = {...}
local iter = function (t, i)
local k, v = next(t, i)
- if v and filter ~= nil then
+ if v and has_filter then
v = filter(v, unpack(args))
end
return k, v