It looks like you're new here. If you want to get involved, click one of these buttons!
Readimage seems to give a error when a image file is not found. The documentation said it would return nil if it could not load a image. Am I doing something wrong?
This code was in the setup() function. The main code is in this github repo : https://github.com/Pakz001/Codea-examples/tree/main/SpriteEditor
--savedimage = image(320,240)
--saveImage(asset.documents.."savedimage.png",savedimage)
savedimage = readImage(asset.documents.savedimage)
if savedimage==nil then
savedimage = image(320,240)
saveImage(asset.documents.."savedimage.png",savedimage)
print("created new save..")
else
getgridfromimage(1,1,cellshor,cellsvert)
print("reading image")
end
Comments
@Pakz This is how I read an image if it may or may not exist yet. This returns nil. You need the .. and the “ “.
Ok, I changed it and it seems to load correctly.
Need to test it on a different ipad though, but this makes sense.
Thx.