You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@unicodecndddd Super只是简单模拟了“继承”的语义,“父类”不是Class()返回的表的元表,只设置在Super这个field上(元表在插件的c++代码里定义了,这个过程已经固化)。单就你这个场景,只能这样写:
local c = Class("b")
function c:test()
c.Super.Super.test(self)
end
当然难看了点。。。当“继承”链上定义了多个相同函数,最好直接用表来访问Super,而不是self.Super
目前unlua内的Class定义的Super只能调用直接继承的lua内的方法。如果继承了多层,Super可能会失效,因为在没有原表的情况下,Super是不会主动向下遍历Super的。大概类似如下代码:
The text was updated successfully, but these errors were encountered: