Dropdown
Last updated
Was this helpful?
Last updated
Was this helpful?
Section:Dropdown({
Name <string>
Search <boolean> -- Enable searching?
Multi <boolean> -- Allow multiple choices?
Required <boolean> -- Force the user to select at minimum one choice?
Options <table>
Default <number or table> -- If Multi is enabled, you must input a table of every option name that you want enabled. If Multi is disabled you must input the order (index) in which the default option is at.
Callback <function(): string or table> -- Multi Dropdowns return a table like such {"Option 1" = true, "Option 3" = true,} Single Dropdowns return the name (no table) of the selected option
}, <string or nil> Flag)
Functions
:UpdateName(<string>)
:SetVisiblity(<boolean>)
:UpdateSelection(<string or number or table>) -- string/number for single, table for multi
:InsertOptions(<table>)
:RemoveOptions(<table>)
:IsOption(<string>: boolean)
:GetOptions(: table) -- Returns a table of every option and if it's true or false (Example: {"Option 1" = true, "Option 2" = false, "Option 3" = false} etc..)
:ClearOptions()
.Value : string or table
.IgnoreConfig <boolean>
.Settings : table -- Not everything may be updated, but Callback should be correct.
Examples
sections.MainSection1:Dropdown({
Name = "Give Weapons",
Search = true,
Multi = true,
Required = false,
Options = {"AK-47", "M4A1", "Desert Eagle", "AWP", "MP5", "SPAS-12"},
Default = {"M4A1", "AWP"},
Callback = function(Value)
local Values = {}
for _, State in next, Value do
if State then
table.insert(Values, _)
end
end
print("Selected Weapons:", table.concat(Values, ", "))
end,
}, "GiveWeaponsDropdown")