summaryrefslogtreecommitdiff
path: root/xmake/core/base/table.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/core/base/table.lua')
-rw-r--r--xmake/core/base/table.lua14
1 files changed, 13 insertions, 1 deletions
diff --git a/xmake/core/base/table.lua b/xmake/core/base/table.lua
index b3e8840e3..5e04b0256 100644
--- a/xmake/core/base/table.lua
+++ b/xmake/core/base/table.lua
@@ -153,7 +153,19 @@ function table.append(array, ...)
return array
end
--- copy the table to self
+-- clone table
+function table.clone(self)
+ local result
+ if type(self) == "table" then
+ result = {}
+ for k, v in pairs(self) do
+ result[k] = v
+ end
+ end
+ return result
+end
+
+-- copy the table (deprecated, please use table.clone)
function table.copy(copied)
local result = {}
copied = copied or {}