Lua function to show mini-images for testing, accompanied by console text

A very simple testing function I made that takes any image from a variable, shrinks it—in a way that preserves most dithers—and overlays it on the screen in one of 9 slots (on a 3x3 grid).

Pick any image, any abitrary slot that doesn't block things you need to see, and specify some accompanying text which gets printed to console along with the slot # for reference.

Call it like this:
imgtest(8, myImage, "white block")

The code:

function imgtest(slot, img, printText)
	--Overlaid 1/3-size image for testing
	--Positioned in slots 1 to 9 on 3x3 grid
	--Must do gfx.sprite.update() in playdate.update()
	local y = math.floor((slot + 2)/3) - 1
	local x = slot - y * 3 - 1
	local s =
	s:moveTo(x*400/3, y*240/3)
	print("IMGTEST "..slot..":", printText)