fix moon.mixin, fixes #99

This commit is contained in:
leaf corcoran 2013-06-08 00:06:56 -07:00
parent 2f4066d9bb
commit fcf36aeb8c
2 changed files with 2 additions and 4 deletions

View File

@ -117,8 +117,7 @@ copy = function(self)
end)() end)()
end end
mixin = function(self, cls, ...) mixin = function(self, cls, ...)
local meta = getmetatable(cls) for key, val in pairs(cls.__base) do
for key, val in pairs(meta.__index) do
if not key:match("^__") then if not key:match("^__") then
self[key] = val self[key] = val
end end

View File

@ -100,8 +100,7 @@ copy = =>
-- mixin class properties into self, call new -- mixin class properties into self, call new
mixin = (cls, ...) => mixin = (cls, ...) =>
meta = getmetatable cls for key, val in pairs cls.__base
for key, val in pairs meta.__index
self[key] = val if not key\match"^__" self[key] = val if not key\match"^__"
cls.__init self, ... cls.__init self, ...