cocos2dx的extern.lua中的class方法为lua扩展了面向对象的功能,这使我们在开发中可以方便的继承原生类 但是用function返回对象的方法来继承C++类是没有super字段的,这使得在需要重写父类方法的时候没办法调用父类方法 在某位大神的博文中看到的代码 local _setVisible = nil local MyLayer = class("MyLayer", function() local layer = CCLayer:create() -- save
做cocos2d-x开发的人可能有不少人在实现类时会利用cocos2d-x自己给出的类的实现,也即在luaBinding目录下extern.lua的文件中给出的实现: --Create an class. function class(classname, super) local superType = type(super) local cls if superType ~= "function" and superType ~= "table" then su