diff options
| author | ruki <[email protected]> | 2016-09-01 14:00:04 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-09-01 14:00:04 +0800 |
| commit | 0783aa7d6de42ea14b2da12f1bfdcd0711fb7f99 (patch) | |
| tree | cf9d25283da3e2a1f6b47903c44be9403edac41a /xmake/core/sandbox/modules/ipairs.lua | |
| parent | 98041add2635b07c13f6016cf2c2f6e8aa81e8db (diff) | |
fix pairs filter bug
Diffstat (limited to 'xmake/core/sandbox/modules/ipairs.lua')
| -rw-r--r-- | xmake/core/sandbox/modules/ipairs.lua | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/xmake/core/sandbox/modules/ipairs.lua b/xmake/core/sandbox/modules/ipairs.lua index 7538b8e4f..72ae63f24 100644 --- a/xmake/core/sandbox/modules/ipairs.lua +++ b/xmake/core/sandbox/modules/ipairs.lua @@ -44,13 +44,16 @@ local table = require("base/table") -- @endcode function sandbox_ipairs(t, filter, ...) + -- has filter? + local has_filter = type(filter) == "function" + -- init iterator local args = {...} local iter = function (t, i) i = i + 1 local v = t[i] if v then - if filter ~= nil then + if has_filter then v = filter(v, unpack(args)) end return i, v |
