diff options
| author | ruki <[email protected]> | 2016-03-18 19:57:22 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-03-18 19:57:22 +0800 |
| commit | 7ff5704f835df20b79db4f672204df9a562058aa (patch) | |
| tree | 936db6ad6da98ae0f97efb45663e933eb54be5a5 /xmake/core/base/table.lua | |
| parent | 34d77b966b9640673b4a6d23758b3d9f51cb1169 (diff) | |
remove install and package from platform
Diffstat (limited to 'xmake/core/base/table.lua')
| -rw-r--r-- | xmake/core/base/table.lua | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/xmake/core/base/table.lua b/xmake/core/base/table.lua index 1ebfa0bc9..5d0bc399a 100644 --- a/xmake/core/base/table.lua +++ b/xmake/core/base/table.lua @@ -319,6 +319,40 @@ function table.unique(array) return array end +-- inherit interfaces and create a new instance +function table.inherit(self) + + -- check + assert(self) + + -- init instance + local instance = {} + for k, v in pairs(self) do + if type(v) == "function" then + instance[k] = v + end + end + + -- ok? + return instance +end + +-- inherit interfaces from the given class +function table.inherit2(self, clasz) + + -- check + assert(self and clasz) + + -- init instance + for k, v in pairs(clasz) do + if type(v) == "function" then + self[k] = v + end + end + + -- ok? + return self +end -- return module: table return table |
