Garry's Mod Wiki

DComboBox:GetOptionText

  string DComboBox:GetOptionText( number index )

Description

Returns an option's text based on the given index.

Arguments

1 number index
The option index.

Returns

1 string
The option's text value.

Example

Create a combo box listing some colors and print the 3rd option's text.

local cbox = vgui.Create("DComboBox") cbox:SetPos(5, 5) cbox:SetSize(200, 20) cbox:SetValue("Colors") cbox:AddChoice("Red") cbox:AddChoice("Green") cbox:AddChoice("Blue") cbox:AddChoice("Yellow") print(cbox:GetOptionText(3))
Output: Blue