Print not working in manu item callback

,

Environment:

  • Windows 11
  • SDK & Simulator version 2.0.3

Expect the console to log a message via the print() function.

Code taken from the Inside Playdate document:

local menu = playdate.getSystemMenu()

local menuItem, error = menu:addMenuItem("Item 1", function()
    print("Item 1 selected")
end)

local checkmarkMenuItem, error = menu:addCheckmarkMenuItem("Item 2", true, function(value)
    print("Checkmark menu item value changed to: ", value)
end)

function playdate.update()
end

No log is shown in the console.

Are you changing the menu options when the menu is open?

The callback will only run if the menu option is changed (value is different on closing than it is in opening).

So if you just open and close the menu then there'll be no logging which is by design.

I'm such an idiot. I was pressing the button for B, not for A, so the menu was cancelling instead of activating.

1 Like