dialog refers to the return value of Dialog:Create
Input
dialog:AddSelect creates a new input field in which you can select one of the specified options.
Parameters
dialog:AddSelect(label, description?, placeholder?, values?, required?)interface SelectValue {
label?: string;
value: string;
}| Name | Type | Description | Required |
|---|---|---|---|
| label | string | The title of the input | Yes |
| description | string | The description of the input field | No |
| placeholder | string | The placeholder of the input field | No |
| values | SelectValue[] | The selectable values | Yes |
| required | boolean | If the value of the field should be valid and required | No |
Example
client/example.lua
local dialog = Dialog:Create('Title');
dialog:AddSelect('Selection', 'Which cat breed do you like best?', 'Choose a mega cool cat breed.', {
{
label = 'British Short Hair',
value = 'br_sh_hair'
},
{
label = 'Tiger',
value = 'tiger'
}
});
local results = dialog:Open();
print(results[1]) -- The value of the selected option