From: Steinar H. Gunderson Date: Fri, 19 Jul 2019 20:23:45 +0000 (+0200) Subject: Document new 1.9.0 menu features. X-Git-Url: https://git.sesse.net/?p=nageru-docs;a=commitdiff_plain;h=cf1c04c621bc3f7b2d580f601fa667a485be7db4 Document new 1.9.0 menu features. --- diff --git a/theme.rst b/theme.rst index e45d636..7667a60 100644 --- a/theme.rst +++ b/theme.rst @@ -375,7 +375,28 @@ labels and function references:: When the user chooses a menu entry, the given Lua function will automatically be called. There are no arguments nor return values. -There currently is no support for checkboxes, submenus, input boxes +Menus can contain submenus, by giving an array instead of a function:: + + ThemeMenu.set( + { "Overlay", { + { "Version A", select_overlay_a }, + { "Version B", select_overlay_b } + }, + { "&Reload overlay", reload_html } + ) + +They can also be checkable, or have checkboxes, by adding a third +array element containing flags for that:: + + ThemeMenu.set( + { "Enable overlay", enable_overlay, Nageru.CHECKED }, -- Currently checked. + { "Enable crashing", make_unstable, Nageru.CHECKABLE } -- Can be checked, but isn't currently. + ) + +When such an option is selected, you probably want to rebuild the menu to +reflect the new state. + +There currently is no support for input boxes, sliders, or the likes. However, do note that since the theme is written in unrestricted Lua, so you can use e.g. `lua-http `_ to listen for external connections and accept more complicated inputs