Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
13
Task/Inheritance-Multiple/Lua/inheritance-multiple.lua
Normal file
13
Task/Inheritance-Multiple/Lua/inheritance-multiple.lua
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
function setmetatables(t,mts) --takes a table and a list of metatables
|
||||
return setmetatable(t,{__index = function(self, k)
|
||||
--collisions are resolved in this implementation by simply taking the first one that comes along.
|
||||
for i, mt in ipairs(mts) do
|
||||
local member = mt[k]
|
||||
if member then return member end
|
||||
end
|
||||
end})
|
||||
end
|
||||
|
||||
camera = {}
|
||||
mobilephone = {}
|
||||
cameraphone = setemetatables({},{camera,mobilephone})
|
||||
Loading…
Add table
Add a link
Reference in a new issue