⚙️CMenuGearAttachment

CMenuGearAttachment metatable.

:Name(): string

Returns widget's name.


Returns widget's parent.


Returns widget type.


:Open(): nil

Opens parent tabs.


:ForceLocalization(newText: string): nil

Not recommended for use due to its complexity

Name
Type
Description

newText

string

Changes text in the widget. The path to the widget is not affected. May be used for dynamic text customization or recolor.


Name
Type
Description

widgetName

string

Finds the widget by name.


:Switch(switchName: string, defaultValue [?]: boolean, imageIcon [?]: string): CMenuSwitch

Name
Type
Description

switchName

string

defaultValue [?]

boolean

(default: false)

imageIcon [?]

string

Path to image or FontAwesome icon unicode. (default: "")

Creates new CMenuSwitch.


:Bind(bindName: string, defaultValue [?]: Enum.ButtonCode, imageIcon [?]: string): CMenuBind

Name
Type
Description

bindName

string

defaultValue [?]

(default: Enum.ButtonCode.BUTTON_CODE_INVALID)

imageIcon [?]

string

Path to image or FontAwesome icon unicode. (default: "")

Creates new CMenuBind.


:Slider(sliderName: string, minValue: integer, maxValue: integer, defaultValue: integer, format [?]: string|fun(value: integer):string): CMenuSliderInt

Name
Type
Description

sliderName

string

minValue

integer

maxValue

integer

defaultValue

integer

format [?]

string|fun(value: integer):string

Format string or function to format value. See example. (default: "%d")

Creates new CMenuSliderInt or CMenuSliderFloat depents on arg types. minValue, maxValue and defaultValue should be integer to create CMenuSliderInt.

Example

-- Create slider with integer values
gear:Slider( "slider", 0, 100, 50, "%d" )
-- Create slider with integer values and custom format function
gear:Slider( "slider", 0, 100, 50, function( value ) return "%d%%" end ) -- turns into
"50%"

:Slider(sliderName: string, minValue: number, maxValue: number, defaultValue: number, format [?]: string|fun(value: number):string): CMenuSliderFloat

Name
Type
Description

sliderName

string

minValue

number

maxValue

number

defaultValue

number

format [?]

string|fun(value: number):string

Format string or function to format value. See example. (default: "%f")

Creates new CMenuSliderFloat.

Example

-- Create slider with float values
gear:Slider( "slider", 0.0, 1.0, 0.5, "%.2f" ) -- turns into "0.50"
-- Create slider with float values and custom format function
gear:Slider( "slider", 0.0, 100.0, 50.0, function( value )
	if value < 50 then
		return "Low(%f)"
	else
		return "High(%f)"
  end
end )

:ColorPicker(colorPickerName: string, color: Color, imageIcon [?]: string): CMenuColorPicker

Name
Type
Description

colorPickerName

string

color

imageIcon [?]

string

Path to image or FontAwesome icon unicode. (default: "")

Creates new CMenuColorPicker.


:Combo(comboName: string, items: string[], defaultValue [?]: integer): CMenuComboBox

Name
Type
Description

comboName

string

items

string[]

defaultValue [?]

integer

Index of default item. (starts from 0) (default: 0)

Creates new CMenuComboBox.


:MultiCombo(multiComboName: string, items: string[], enabledItems: string[]): CMenuMultiComboBox

Name
Type
Description

multiComboName

string

items

string[]

enabledItems

string[]

table of enabled items

Creates new CMenuMultiComboBox.

Example

gear:MultiCombo( "multiCombo", { "item1", "item2", "item3" }, { "item1", "item3" } )

:MultiSelect(multiSelectName: string, items: {nameId: string, imagePath: string, isEnabled: boolean}[], expanded [?]: boolean): CMenuMultiSelect

Name
Type
Description

multiSelectName

string

items

{nameId: string, imagePath: string, isEnabled: boolean}[]

See example.

expanded [?]

boolean

false if you want to create MultiSelect in collapsed state. (default: false)

Creates new CMenuMultiSelect.

Example

gear:MultiSelect( "multiSelect", {
 	{ "1", "panorama/images/heroes/icons/npc_dota_hero_antimage_png.vtex_c", false },
 	{ "2", "panorama/images/heroes/icons/npc_dota_hero_antimage_png.vtex_c", false },
}, true )

:Input(inputName: string, defaultValue [?]: string, imageIcon [?]: string): CMenuInputBox

Name
Type
Description

inputName

string

defaultValue [?]

string

(default: "")

imageIcon [?]

string

Path to image or FontAwesome icon unicode. (default: "")

Creates new CMenuInputBox.


:Label(labelText: string, imageIcon [?]: string): CMenuLabel

Name
Type
Description

labelText

string

imageIcon [?]

string

Path to image or FontAwesome icon unicode. (default: "")

Creates new CMenuLabel.


:Visible(value: boolean): nil

Name
Type
Description

value

boolean

Gets or sets visible state. Depends on argument.

Example

-- setter
widget:Visible(false)

:Visible(): boolean

Example

-- getter
local isVisible = widget:Visible()

:Disabled(value: boolean): nil

Name
Type
Description

value

boolean

Gets or sets disabled state. Depends on argument.

Example

-- setter
widget:Disabled( false )

:Disabled(): boolean

Example

-- getter
local isDisabled = widget:Disabled()

Last updated