An empty Window menu will not be drawn. Adding items to an empty Window menu will draw it again.
Menu:clear() method
Remove all items from the Menu.
Return value
This function returns no value.Example
local ui = require "ui"
-- create a simple Window
local win = ui.Window("Menu:clear() sample", 316, 246)
local button = ui.Button(win, "Clear 'Items' Menu", 110, 86)
-- create a Window menu with one menu item "Items" with an empty sub menu
win.menu = ui.Menu("Items 1", "Items 2", "Items 3")
function button:onClick()
win.menu:clear()
end
-- shows the Window
win:show()
-- update user interface
repeat
ui.update()
until not win.visible