diff options
| author | OpportunityLiu <[email protected]> | 2019-06-19 12:56:50 +0800 |
|---|---|---|
| committer | OpportunityLiu <[email protected]> | 2019-06-19 12:56:50 +0800 |
| commit | 8dedbdc46bf2b5414d3d65a2056546b5f6cecd79 (patch) | |
| tree | 0cf2de32db0d65185e19b3c88e5783ca8e672003 /xmake/core/base/table.lua | |
| parent | ec47d59df254531303c0885b1a4d8c5d35deb42c (diff) | |
fix
Diffstat (limited to 'xmake/core/base/table.lua')
| -rw-r--r-- | xmake/core/base/table.lua | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/xmake/core/base/table.lua b/xmake/core/base/table.lua index 6e7311f68..fab299da1 100644 --- a/xmake/core/base/table.lua +++ b/xmake/core/base/table.lua @@ -24,7 +24,7 @@ local table = table or {} -- clear the table function table.clear(self) for k in next, self do - rawset(self, k, nil) + rawset(self, k, nil) end end @@ -176,23 +176,25 @@ function table.slice(self, first, last, step) return sliced end -local function is_array(table) - local i = 0 - for _ in pairs(table) do - i = i + 1 - if table[i] == nil then return false end - end - return true -end - -- is array? function table.is_array(array) - return type(array) == "table" and is_array(array) + if type(array) == "table" then + local i = 0 + for _ in pairs(array) do + i = i + 1 + if array[i] == nil then + return false + end + end + return true + else + return false + end end -- is dictionary? function table.is_dictionary(dict) - return type(dict) == "table" and not is_array(dict) + return type(dict) == "table" and not table.is_array(dict) end -- unwrap object if be only one |
