summaryrefslogtreecommitdiff
path: root/xmake/core/base/table.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-08-09 11:02:00 +0800
committerruki <[email protected]>2017-08-09 11:02:00 +0800
commit467e97b99dc9b16dd3db3a5ad743ea954185d497 (patch)
treeb97f06286577155b4aa6814ab92cc85458558b43 /xmake/core/base/table.lua
parent874aae23f8f36de978263e1f295e8c7143025f53 (diff)
add extra info for interpreter values and pathes
Diffstat (limited to 'xmake/core/base/table.lua')
-rw-r--r--xmake/core/base/table.lua38
1 files changed, 4 insertions, 34 deletions
diff --git a/xmake/core/base/table.lua b/xmake/core/base/table.lua
index db06f094f..eb1988cee 100644
--- a/xmake/core/base/table.lua
+++ b/xmake/core/base/table.lua
@@ -158,43 +158,13 @@ function table.slice(self, first, last, step)
end
-- is array?
-function table.is_array(self)
-
- -- not table?
- if type(self) ~= "table" then
- return false
- end
-
- -- is array?
- for k, v in pairs(self) do
- if type(k) == "number" then
- return true
- end
- break
- end
-
- -- dictionary
- return false
+function table.is_array(array)
+ return type(array) == "table" and array[1] ~= nil
end
-- is dictionary?
-function table.is_dictionary(self)
-
- -- not table?
- if type(self) ~= "table" then
- return false
- end
-
- -- is dictionary?
- for k, v in pairs(self) do
- if type(k) == "string" then
- return true
- end
- break
- end
-
- -- array
- return false
+function table.is_dictionary(dict)
+ return type(dict) == "table" and dict[1] == nil
end
-- dump it with the level