How to use playdate.ui.gridview:getSelection()?

Trying to get it for where if A is just pressed and a specific column is selected then another menu pops up. However getSelection returns 3 numbers spaced out and I dont know how to specifically target if one of them is true in a true/false statement?

CODE:

if pd.buttonJustPressed(pd.kButtonA) and gridview:getSelection() == (what do I put here for columns?) then

        gridviewSpriteSide:setVisible(true)

    end

You'll need to capture all three return values before testing:

local section, row, column = gridView:getSelection()
if pd.buttonJustPressed(pd.kButtonA) and column == 1 then   -- (or whatever you're testing for)
  -- ...
end

Thank you so much, this worked!

1 Like