local CocoStudioTestScene = class(“CocoStudioTestScene”)
CocoStudioTestScene.__index = CocoStudioTestScene
function CocoStudioTestScene.extend(target)
local t = tolua.getpeer(target)
if not t then
t = {}
tolua.setpeer(target, t)
end
setmetatable(t, CocoStudioTestScene)
return target
end
我不是很明白tolua.getpeer(target)的作用
如果是我平常写的话,大概会直接写CocoStudioTestScene = class(“CocoStudio”, function () return CCScene:create() end ) 这样子
然后function CocoStudioTestScene:create() return self:new() end
不知道这种和使用extend的用法有什么区别
希望有人可以给我解释一下这个tolua.getpeer(target)最终使用create生成的,和我直接那样子继承,然后create的区别


