diff options
| author | ruki <[email protected]> | 2015-06-09 21:26:04 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2015-06-09 21:26:04 +0800 |
| commit | d61169b7ea72b22ca89d5a6575865af9148d958e (patch) | |
| tree | 47d83d2cc74e1762a01b837686d16f2dc41a78d4 /xmake/scripts/base/table.lua | |
| parent | e18c9d7a5718c80852fab0eb89161b4da28b7a94 (diff) | |
list action menu automaticlly
Diffstat (limited to 'xmake/scripts/base/table.lua')
| -rw-r--r-- | xmake/scripts/base/table.lua | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/xmake/scripts/base/table.lua b/xmake/scripts/base/table.lua index 1e0250bce..d6f6990d7 100644 --- a/xmake/scripts/base/table.lua +++ b/xmake/scripts/base/table.lua @@ -65,5 +65,33 @@ function table.join2(self, ...) return self end +-- clear the table +function table.clear(self) + + -- check + assert(self and type(self) == "table") + + -- clear it + for k in next, self do + rawset(self, k, nil) + end +end + +-- copy the table to self +function table.copy2(self, copied) + + -- check + assert(self and copied) + + -- clear self first + table.clear(self) + + -- copy it + for k, v in pairs(copied) do + self[k] = v + end + +end + -- return module: table return table |
