diff --git a/moon/init.lua b/moon/init.lua index f05fe07..91d20e2 100644 --- a/moon/init.lua +++ b/moon/init.lua @@ -117,8 +117,7 @@ copy = function(self) end)() end mixin = function(self, cls, ...) - local meta = getmetatable(cls) - for key, val in pairs(meta.__index) do + for key, val in pairs(cls.__base) do if not key:match("^__") then self[key] = val end diff --git a/moon/init.moon b/moon/init.moon index 7fd6c59..ef07bba 100644 --- a/moon/init.moon +++ b/moon/init.moon @@ -100,8 +100,7 @@ copy = => -- mixin class properties into self, call new mixin = (cls, ...) => - meta = getmetatable cls - for key, val in pairs meta.__index + for key, val in pairs cls.__base self[key] = val if not key\match"^__" cls.__init self, ...