diff options
| author | ruki <[email protected]> | 2022-03-02 23:26:00 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-03-02 23:26:00 +0800 |
| commit | aeb97fe6d7d7385fddb494dc4f4a892993e03876 (patch) | |
| tree | 29d97c4b90fd0af6d841b7941bc22f288a7448b8 /xmake/core/base/table.lua | |
| parent | cfdffbc896a2999c594caccfdaa323df16e3950b (diff) | |
fix wrap
Diffstat (limited to 'xmake/core/base/table.lua')
| -rw-r--r-- | xmake/core/base/table.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/xmake/core/base/table.lua b/xmake/core/base/table.lua index 73556c9fc..232f6962a 100644 --- a/xmake/core/base/table.lua +++ b/xmake/core/base/table.lua @@ -165,9 +165,9 @@ end -- copy the table to self function table.copy2(self, copied) - assert(type(copied) == "table") table.clear(self) - for k, v in pairs(copied) do + copied = copied or {} + for k, v in pairs(table.wrap(copied)) do self[k] = v end end @@ -310,7 +310,7 @@ end -- unwrap object if be only one function table.unwrap(object) - if type(object) == "table" and not getmetatable(object) then + if type(object) == "table" and not object.__object__ then if #object == 1 then return object[1] end @@ -323,7 +323,7 @@ function table.wrap(object) if nil == object then return {} end - if type(object) ~= "table" or getmetatable(object) then -- maybe object, we need wrap it too + if type(object) ~= "table" or object.__object__ then return {object} end return object |
