Are some imports implicit?

This compiles and runs just fine in the simulator without import "CoreLibs/graphics"

//main.lua
local gfx <const> = playdate.graphics

function playdate.update()
    gfx.clear(gfx.kColorBlack)
end

If you check the Corelibs/graphics.lua file in the SDK, you can see that it's mostly for stuff like drawing aligned text and images, arcs, circles, etc. that can be built on top of the firmware and not alongside it. It isn't needed for basic stuff like clearing the screen.

I can see what you mean. Thank you. I'm new to Lua, so I'm still trying to find my way around.

1 Like