elua: better mixin behavior (+ fix bad lookup)

This commit is contained in:
Daniel Kolesa 2015-02-25 14:01:45 +00:00
parent 2255508b0b
commit 7806e79024
1 changed files with 9 additions and 2 deletions

View File

@ -212,9 +212,16 @@ end
M.class_mixin = function(name, mixin)
local cl = classes[name]
local mi = classes[mixin]
local ck = "__mixin_" .. mixin
-- do not mixin if it already has been mixed in previously
-- but only do it for mixins, not for ifaces, for proper lookup order
if mi[ck] and cl[ck] then
return
end
-- mixin properties/events
mixin_tbl(cl, mixin, "__properties")
mixin_tbl(cl, mixin, "__events")
mixin_tbl(cl, mi, "__properties")
mixin_tbl(cl, mi, "__events")
-- mixin the rest
cl:mixin(classes[mixin])
end