DComboBox/GetOptionText

From Garry's Mod
Jump to: navigation, search
 DComboBox:GetOptionText( )

Contents

DescriptionPanelFunc

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

Arguments

number index

The option index.

Returns

string

The option's text value.

Examples

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
Personal tools
Navigation