为什么我用cc.ComponentLua 的时候
cc.ComponentLua总是为 nil
lua-test-src里没有问题,我自己单独建一个项目,就用不了。
local sceneLuaComponent = cc.ComponentLua:create(“src/app/views/scene.lua”);
提示: attempt to index field ‘ComponentLua’ (a nil value)
为什么我用cc.ComponentLua 的时候
cc.ComponentLua总是为 nil
lua-test-src里没有问题,我自己单独建一个项目,就用不了。
local sceneLuaComponent = cc.ComponentLua:create(“src/app/views/scene.lua”);
提示: attempt to index field ‘ComponentLua’ (a nil value)
我的代码
local function GetLuaFileName(fileName)
local targetPlatform = cc.Application:getInstance():getTargetPlatform()
if cc.PLATFORM_OS_WINDOWS == targetPlatform then
return fileName
else
return fileName…“c”
end
end
–创建骨骼动画组件
function GameObject:CreateSpineComponent()
local spineComponent = cc.ComponentLua:create(GetLuaFileName(“src/component/SpineAnimation.lua”)) – 大小写敏感哦
spineComponent:setName(“spine”)
self:addComponent(spineComponent)
return spineComponent
end
为什么后面要加个c呢