summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2016-03-18 21:06:10 +0800
committerruki <[email protected]>2016-03-18 21:06:10 +0800
commit9b70f476c9e8603ff3d595490b9a7186a996fbe7 (patch)
tree49978712358251f593f727c9f816562a213a68ad
parent413190f470fd28db5fb3f1c75a2b90183a327197 (diff)
wrap pairs and ipairs for sandbox module
-rwxr-xr-xxmake/actions/config/config_h.lua4
-rw-r--r--xmake/core/base/table.lua2
-rw-r--r--xmake/core/sandbox/modules/ipairs.lua12
-rw-r--r--xmake/core/sandbox/modules/pairs.lua12
4 files changed, 25 insertions, 5 deletions
diff --git a/xmake/actions/config/config_h.lua b/xmake/actions/config/config_h.lua
index c28e49f89..c8f7449b6 100755
--- a/xmake/actions/config/config_h.lua
+++ b/xmake/actions/config/config_h.lua
@@ -67,7 +67,7 @@ function _make_for_target(files, target)
local undefines = table.copy(target:get("undefines_h"))
-- make the options
- for _, name in ipairs(table.wrap(target:get("options"))) do
+ for _, name in ipairs(target:get("options")) do
-- get option if be enabled
local opt = nil
@@ -119,7 +119,7 @@ function _make_for_target_with_deps(files, targetname)
_make_for_target(files, target)
-- make configure for the dependent targets?
- for _, dep in ipairs(table.wrap(target:get("deps"))) do
+ for _, dep in ipairs(target:get("deps")) do
_make_for_target_with_deps(files, dep)
end
diff --git a/xmake/core/base/table.lua b/xmake/core/base/table.lua
index 5d0bc399a..c99985dab 100644
--- a/xmake/core/base/table.lua
+++ b/xmake/core/base/table.lua
@@ -267,7 +267,7 @@ end
function table.wrap(object)
-- no object?
- if not object then
+ if nil == object then
return {}
end
diff --git a/xmake/core/sandbox/modules/ipairs.lua b/xmake/core/sandbox/modules/ipairs.lua
index a3d2f636e..d965c9e5e 100644
--- a/xmake/core/sandbox/modules/ipairs.lua
+++ b/xmake/core/sandbox/modules/ipairs.lua
@@ -20,6 +20,16 @@
-- @file ipairs.lua
--
+-- load modules
+local table = require("base/table")
+
+-- ipairs
+function sandbox_ipairs(...)
+
+ -- wrap it for nil
+ return ipairs(table.wrap(...))
+end
+
-- load module
-return ipairs
+return sandbox_ipairs
diff --git a/xmake/core/sandbox/modules/pairs.lua b/xmake/core/sandbox/modules/pairs.lua
index ce7729bd5..7d93f7f16 100644
--- a/xmake/core/sandbox/modules/pairs.lua
+++ b/xmake/core/sandbox/modules/pairs.lua
@@ -20,6 +20,16 @@
-- @file pairs.lua
--
+-- load modules
+local table = require("base/table")
+
+-- pairs
+function sandbox_pairs(...)
+
+ -- wrap it for nil
+ return pairs(table.wrap(...))
+end
+
-- load module
-return pairs
+return sandbox_pairs