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