Playdate.menu functions crash

main.lua:1: calling 'removeAllMenuItems' on bad self (playdate.menu expected, got table)
stack traceback:
	[C]: in method 'removeAllMenuItems'
	main.lua:1: in main chunk

Same story for getMenuItems

Using pdc 1.13.0

This happens when no items are added. Possibly also when there are items.

Minimal sample:

playdate.menu:removeAllMenuItems()

I expected this to be the table -> userdata issue, that might have been resolved in 1.13.1beta2 that I got from here: Dropbox - File Deleted - Simplify your life

But alas, this is not the case.

Issue also affects beta2 pdc with 13.1-beta3 on device

I'm not sure if this has worked in the past, but you should use playdate.getSystemMenu() to get the system menu instance (which is of type playdate.menu):

local menu = playdate.getSystemMenu()
menu:removeAllMenuItems()
1 Like

Thanks, you are correct.

I guess I was thrown off guard by the error message

1 Like