参考了Cocos-Lua中的functions.lua里面的class、setmetatableindex 方法 local base = {} function base:ctor() print "call base ctor" end function base:run() print "call base run" end function base:move() print "call base move" end local obj = setmetatable({base = base}, {__index = base}) function obj.new(...) local instance = {} setmetatable(instance, {__index = obj}) instance:ctor() return instance end function obj:ctor() self.base.ctor(self) end function obj:move() print "call obj move" end local o1 = obj.new() o1:move() o1:run() --output --[[ call base ctor call obj move call base run ]]