summaryrefslogtreecommitdiff
path: root/xmake/core/base/table.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-09-28 20:42:39 +0800
committerGitHub <[email protected]>2022-09-28 20:42:39 +0800
commit73c22237fb886379beb347fd9a2908e31f82ee9c (patch)
tree14715c2bbc90cc75f84994be127f77058be8795f /xmake/core/base/table.lua
parent575706825c48cfb9af0d22cc88ff4f826a917455 (diff)
parent82bfc71e7810157e8f71d43d4a2d82b609c17bf9 (diff)
Merge pull request #2874 from xmake-io/rule
Support for dynamic creation and injection of rules and targets
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 {}