Module menu

Functions for interacting with the ML menu.

Functions

get(menu, entry[, ret_type]) Get the value of some existing ML menu entry.
set(menu, entry, value) Set the value of some existing ML menu entry.
open() Open ML menu.
close() Close ML menu.
select([menu[, entry]]) Select an item from ML menu.
block(enabled) Block the ML menu from redrawing (if you wand to do custom drawing).
new(definition) Creates a new menu item.

Fields

visible Get whether or not the ML menu is visible.

Class menu

menu.value Current value of the menu item.
menu.name Name for the menu item.
menu.help Help text for the menu item (line 1).
menu.help2 Help text for the menu item (line 2).
menu.advanced Advanced setting in submenus.
menu.depends_on Dependencies for this menu item.
menu.edit_mode Editing mode for the menu item.
menu.icon_type The type of icon to use for this menu item (override only if the default choice is not good).
menu.max The maximum value the menu item can have.
menu.min The minimum value the menu item can have.
menu.selected Whether or not the menu is selected.
menu.hidden Hidden from menu.
menu.submenu_height Submenu Height.
menu.submenu_width Submenu Width.
menu.unit The unit for the menu item's value.
menu.works_best_in Suggested operating mode for this menu item.
menu:select(delta) Function called when menu is toggled.
menu:update() Function called when menu is displayed.
menu:info() Function called when menu is displayed.
menu:rinfo() Function called when menu is displayed.
menu:warning() Function called when menu is displayed.
menu.choices List of strings to display as choices in the menu item.
menu.submenu Table of more menu tables that define a submenu.
menu:remove() Removes this menu entry.


Functions

get(menu, entry[, ret_type])
Get the value of some existing ML menu entry.

Parameters:

  • menu string name of the parent menu ('Audio', 'Expo', 'Overlay', 'Shoot', 'Movie', etc)
  • entry string name of the menu entry
  • ret_type int or string desired return type (optional, default string)

    By default, this function returns a string (the current menu text).

    Pass any integer to get the result as int, i.e. the internal integer value for this menu entry. Usually, 0 = OFF and 1 = ON, numeric values "just work", pickbox indices are from 0, but each menu entry may define its own meaning - YMMV).

    You may also pass a string (for compatibility reasons); this will not change the default behavior. (optional)

Returns:

    int, string or nil the current value of the requested menu entry (nil if menu entry not found)
set(menu, entry, value)
Set the value of some existing ML menu entry.

Parameters:

  • menu string name of the parent menu ('Audio', 'Expo', 'Overlay', 'Shoot', 'Movie', etc).
  • entry string name of the menu entry.
  • value int or string the value to set.

Returns:

    bool or nil whether or not the call was sucessful, or nil if the requested menu entry was not found.
open()
Open ML menu.
close()
Close ML menu.
select([menu[, entry]])
Select an item from ML menu.

Parameters:

  • menu string name of the parent menu ('Audio', 'Expo', 'Overlay', 'Shoot', 'Movie', etc) (optional)
  • entry string name of the menu entry (optional)

Returns:

    bool whether or not the call was sucessful.
block(enabled)
Block the ML menu from redrawing (if you wand to do custom drawing).

Parameters:

  • enabled bool
new(definition)
Creates a new menu item.

Parameters:

Returns:

    a menu object

Usage:

    mymenu = menu.new
    {
        parent  = "Movie",
        name    = "Lua Test Script",
        help    = "Some help for this script.",
        submenu =
        {
            {
                name    = "Run",
                help    = "Run some action.",
                update  = "",
            },
            {
                name    = "Parameter Example",
                help    = "Help for Parameter Example",
                min     = 0,
                max     = 100,
                unit    = UNIT.DEC,
                warning = function(this) if this.value == 5 then return "this value is not supported" end end,
            },
            {
                name    = "Choices Example",
                choices = { "choice1", "choice2", "choice3" },
            }
        },
        update = function(this) return this.submenu["Choices Example"].value end,
    }
    
    mymenu.submenu["Run"].select = function()
        print("Parameter Example= "..mymenu.submenu["Parameter Example"].value)
        print("Choices Example= "..mymenu.submenu["Choices Example"].value)
    end

Fields

visible
Get whether or not the ML menu is visible.
  • visible bool

Class menu

Represents a menu item.
menu.value
Current value of the menu item.
menu.name
Name for the menu item.
menu.help
Help text for the menu item (line 1).
menu.help2
Help text for the menu item (line 2).
menu.advanced
Advanced setting in submenus.
  • advanced bool
menu.depends_on
Dependencies for this menu item. If the dependecies are not met, the item will be greyed out and a warning will appear at the bottom of the screen.
menu.edit_mode
Editing mode for the menu item.

Set to 1 to show the LiveView image while changing values in this menu.

  • edit_mode int
menu.icon_type
The type of icon to use for this menu item (override only if the default choice is not good).
menu.max
The maximum value the menu item can have.
  • max int
menu.min
The minimum value the menu item can have.
  • min int
menu.selected
Whether or not the menu is selected.
  • selected int
menu.hidden
Hidden from menu.
  • hidden bool
menu.submenu_height
Submenu Height.
  • submenu_height int
menu.submenu_width
Submenu Width.
  • submenu_width int[opt] (override if needed)
menu.unit
The unit for the menu item's value.
menu.works_best_in
Suggested operating mode for this menu item.
menu:select(delta)
Function called when menu is toggled.

Parameters:

  • delta int
menu:update()
Function called when menu is displayed. Return a string to be displayed.

Returns:

    string
menu:info()
Function called when menu is displayed. Return a string to be displayed in the info area (in green).

Returns:

    string
menu:rinfo()
Function called when menu is displayed. Return a string to be displayed on the right side of the menu item.

Returns:

    string
menu:warning()
Function called when menu is displayed. Return a string when there is a warning (menu will be greyed out).

Returns:

    string
menu.choices
List of strings to display as choices in the menu item.
menu.submenu
Table of more menu tables that define a submenu.
menu:remove()
Removes this menu entry.
generated by LDoc 1.4.3 Last updated 2018-12-23 23:12:04