Grid view crank scrolling issues

I am making a gridview in the Lua SDK and when trying to use the crank to change row, rotating the crank forward gives this error:

Update error: CoreLibs/ui/gridview.lua:783: attempt to index a nil value (local 'self')
stack traceback:
	CoreLibs/ui/gridview.lua:783: in field 'selectNextRow'
	main.lua:47: in function <main.lua:34>

Here is the code:

import "Corelibs/graphics"
import "Corelibs/timer"
import "Corelibs/ui"
import "Corelibs/sprites"
import "Corelibs/crank"

local pd <const> = playdate
local gfx <const> = playdate.graphics

local gridview = pd.ui.gridview.new(32, 32)

gridview:setNumberOfColumns(8)
gridview:setNumberOfRows(6)
gridview:setCellPadding(2, 2, 2, 2)

local gridviewSprite = gfx.sprite.new()
gridviewSprite:setCenter(0, 0)
gridviewSprite:moveTo(100, 70)
gridviewSprite:add()

function gridview:drawCell(section, row, column, selected, x, y, width, height)
	if selected then
		gfx.fillCircleInRect(x, y, width, height)
		gfx.setImageDrawMode(gfx.kDrawModeFillWhite)
	else
		gfx.drawCircleInRect(x, y, width, height)
		gfx.setImageDrawMode(gfx.kDrawModeCopy)
	end
	local cellText = tostring(row) .. "-" .. tostring(column)
	local fontHeight = gfx.getSystemFont():getHeight()
	gfx.drawTextInRect(cellText, x, y + (height/2 - fontHeight/2) + 2, width, height, nil , nil, kTextAlignment.center)
end

function pd.update()
	if pd.buttonJustPressed(pd.kButtonUp) then
		gridview:selectPreviousRow(true)
	elseif pd.buttonJustPressed(pd.kButtonDown) then
		gridview:selectNextRow(true)
	elseif pd.buttonJustPressed(pd.kButtonLeft) then
		gridview:selectPreviousColumn(false)
	elseif pd.buttonJustReleased(pd.kButtonRight) then
		gridview:selectNextColumn(false)
	end

	local crankTicks = pd.getCrankTicks(2)
	if crankTicks == 1 then
		gridview.selectNextRow()
	elseif crankTicks == -1 then
		gridview:selectPreviousRow(true)
	end

	local gridviewImage = gfx.image.new(200, 100)
	gfx.pushContext(gridviewImage)
		gridview:drawInRect(0, 0, 200, 100)
	gfx.popContext()
	gridviewSprite:setImage(gridviewImage)

	gridview:drawInRect(100, 70, 200, 100)

	gfx.sprite.update()
	pd.timer.updateTimers()
end

Thanks for the help if you can.

I think you just need to change the dot on line 47 (gridview.selectNextRow()) to a colon.

Oops! :person_facepalming: I am so used to Python syntax and did that.