elua: multiple inheritance aware is_a

This commit is contained in:
Daniel Kolesa 2015-02-25 15:16:35 +00:00
parent 212571c406
commit 1e83761810
1 changed files with 6 additions and 6 deletions

View File

@ -52,13 +52,13 @@ M.Object = {
is_a = function(self, base)
if self == base then return true end
local pt = self.__proto
local is = (pt == base)
while not is and pt do
pt = pt.__proto
is = (pt == base)
local protos = self.__protos
for i = 1, #protos do
if protos[i]:is_a(base) then
return true
end
end
return is
return false
end,
add_parent = function(self, parent)