Just dropped the latest corona-lua folders into our project and received the error: RegionAttachment.lua:137: attempt to index field 'region' (a nil value).
Our old corona-lua didn't have this issue so something in the new version is not working. It seems to be coming from the following block of our code, which uses skeleton:createImages where the latest example uses the imageLoader function.
local imageSuffix = display.imageSuffix
local suffix
if imageSuffix == "@2" or display.pixelHeight > 2048 then
---
Don't append @2 if it has it already
suffix = ""
else suffix = params.suffix or "@2"
---
Do add the @2 suffix or a passed in suffix firstly.
end
local json = spine.SkeletonJson.new()
json.scale = 1
local skeletonData = json:readSkeletonDataFile("spineData/"..data..".json")
local skeleton = spine.Skeleton.new(skeletonData, nil)
local root = skeleton:getRootBone ()
---
---
Attachment Loader
---
function skeleton:createImage (attachment)
---
called by spine.lua (function self:createImage (attachment))
return display.newImageRect("spineData/"..dir..skin..attachment.name..suffix..".png", attachment.width, attachment.height)
end
If it is we need to update createImages to imageLoader can you provide an example of the following code without atlas support as we need to continue using separate images:
local imageLoader = function (path)
local paint = { type = "image", filename = "data/" .. path }
return paint
end
---
load the atlas
local atlas = spine.TextureAtlas.new(spine.utils.readFile("data/" .. atlasFile), imageLoader)
---
load the JSON and create a Skeleton from it
local json = spine.SkeletonJson.new(spine.AtlasAttachmentLoader.new(atlas))
json.scale = scale
local skeletonData = json:readSkeletonDataFile("data/" .. jsonFile)
local skeleton = spine.Skeleton.new(skeletonData)