Select
Used to select singular values from a list of arguments.
Functions
Only
Select.Only(index: number,--
The index of the value to select
...: any--
The values to select from
) → any?--
The selected value
Selects the value at the given index.
if Select.Only(2, false, true) then
-- This will run
end
First
Select.First(...: any--
The values to select from
) → any?--
The first selected value
Selects the first value from the given arguments.
local MyString = "Hello World"
print(Select.First(MyString:gsub("Hello", "World"))) -- "World World"
Last
Select.Last(...: any--
The values to select from
) → any?--
The last selected value
Selects the last value from the given arguments.
print(Select.Last(1, 2, 3)) -- 3
Random
Select.Random(...: any--
The values to select from
) → any?--
The random selected value
Selects a random value from the given arguments.
print(Select.Random(1, 2, 3)) -- 1, 2, or 3