Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Readimage compile error vs exists(nil)

in Questions Posts: 20

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 :

    --savedimage = image(320,240)
    savedimage = readImage(asset.documents.savedimage)
    if savedimage==nil then
        savedimage = image(320,240)
        print("created new save..")
        print("reading image")


  • dave1707dave1707 Mod
    Posts: 9,988

    @Pakz This is how I read an image if it may or may not exist yet. This returns nil. You need the .. and the “ “.

  • Posts: 20

    Ok, I changed it and it seems to load correctly.

    Need to test it on a different ipad though, but this makes sense.


Sign In or Register to comment.