elua: slightly less broken mixin behavior

This commit is contained in:
Daniel Kolesa 2015-02-25 12:09:16 +00:00
parent 964d6e559f
commit f0bf599435
1 changed files with 5 additions and 5 deletions

View File

@ -200,13 +200,13 @@ end
local mixin_tbl = function(cl, mixin, field)
local mxt = mixin[field]
if mxt then
local clt = cl[field]
local clt = rawget(cl, field)
if not clt then
cl[field] = mxt
else
for k, v in pairs(mxt) do clt[k] = v end
-- will always succeed, even if it means deep lookups
clt = cl.__proto[field]:clone()
rawset(cl, field, clt)
end
mixin[field] = nil
for k, v in pairs(mxt) do clt[k] = v end
end
end