Solved: Error loading images - playdate.graphics.image.new() expects a dimensions argument

Hi all.

I'm 10 minutes into my learning experience and here I am :slight_smile:

I'm getting this error while trying to load an image: playdate.graphics.image.new() expects a dimensions argument (with optional background color) or a file name

UPDATE: If I move the image into source (and change the path in the code accordingly) no errors are thrown, but also the image isn't displayed. I have a rectangle on screen just to see something working, and that also isn't displayed with the image moved and no errors.

UPDATE 2: I'll keep this here in case it helps people who find us on Google. I restarted the emulator and that solved it. It was that simple.

The code is very simple:

import "CoreLibs/object"
import "CoreLibs/graphics"
import "CoreLibs/sprites"
import "CoreLibs/timer"

local gfx <const> = playdate.graphics
local playerSprite = nil

local function init()
    local playerImage = gfx.image.new("images/robot")
    playerSprite = gfx.sprite.new(playerImage)
    playerSprite:moveTo(200, 120)
    playerSprite:add()
end

init()

function playdate.update()
    gfx.sprite.update()
end

I thought it may have been the image so I've tried exporting PNG files from Photoshop and some pixel art tools, and then downloaded some. Same deal. I'm on Mac using Visual Studio Code. Latest node, latest SDK, latest VS Code etc.

The build without debugging kicks off the simulator and works if I take out references to creating a sprite. I assume it can't see the image.

Folder structure is:

-source
--main.lua
--images
---robot.png

Any ideas?

Thanks.