diff options
| author | ruki <[email protected]> | 2016-03-17 11:17:11 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-03-17 11:17:11 +0800 |
| commit | 2b233ade0aba7cb061d7b576357a462910c4b62f (patch) | |
| tree | e81f198ef7b2e84ecb736dbaa3fe9057308b0187 /xmake/core/base/table.lua | |
| parent | 713413a6f962704fdb5078a38b32c8637eca3d7a (diff) | |
make config.h
Diffstat (limited to 'xmake/core/base/table.lua')
| -rw-r--r-- | xmake/core/base/table.lua | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/xmake/core/base/table.lua b/xmake/core/base/table.lua index f26678c09..363f6efe0 100644 --- a/xmake/core/base/table.lua +++ b/xmake/core/base/table.lua @@ -80,10 +80,29 @@ function table.clear(self) end -- copy the table to self +function table.copy(copied) + + -- init it + copied = copied or {} + + -- copy it + local result = {} + for k, v in pairs(copied) do + result[k] = v + end + + -- ok + return result +end + +-- copy the table to self function table.copy2(self, copied) -- check - assert(self and copied) + assert(self) + + -- init it + copied = copied or {} -- clear self first table.clear(self) |
