Skip to main content

Add a picker (:add_picker)

Declaration

dialog_obj = dialog_obj:add_picker(label, options [, default_option])

Parameters

  • label
    String. The label text shown on the left of the picker
  • options
    Table. Ordered list of option names; names must be unique
  • default_option
    String, optional. Default selected option name. Default: first option

Returns

  • dialog_obj
    Dialog. Returns the dialog itself
  • :show() return type
    String. The selected option name

Description

Add a picker to the dialog

Example

local c, s = dialog():add_picker('A picker', {'Choice1', 'Choice2', 'Choice3'}):show()
sys.alert('Your choice: ' .. s['A picker'])

Note: Uses function outside this chapter sys.alert

Full example

See :show()