makotok / Hanappe

Hanappe is a game framework for MOAI SDK.
Other
107 stars 41 forks source link

Problems with class.instanceOf #116

Open lihaochen910 opened 4 years ago

lihaochen910 commented 4 years ago

'class.instanceOf' may have problems This is my modified version:

function class:instanceOf(clazz)
    local curClass = self.__class
    while curClass do
        if curClass == clazz then
            return true
        end
        curClass = curClass.__super
    end
    return false
end

Replace "curClass = self.super" with "curClass = curClass.super"