ccui.Scale9Sprite:create argument #2 is 'string'; 'table' expected

从quick cocos2dx-lua 版本3.8.x迁到版本3.9.1,
之前能用的Scale9Sprite初始化报错:

ccui.Scale9Sprite:create argument #2 is 'string'; 'table' expected

原来代码

...
local someSprite = display.newScale9Sprite(filePath, x, y, cc.size(width, height), cc.rect(xx, xx, xx, xx))
  :addTo(someNode)
...

修改为

...
local someSprite = display.newScale9Sprite(filePath, x, y, cc.size(width, height))
  :addTo(someNode)
someSprite:setCapInsets(cc.rect(xx, xx, xx, xx))
...

一句话, capInsets不要用在初始化里, 单独一行setCapInsets函数设置
参考:

  1. Scale9Sprite不要在初始化的时候setCapInsets

你可能感兴趣的:(ccui.Scale9Sprite:create argument #2 is 'string'; 'table' expected)