Skip to main content

Base Element

Functions​

ReturnsNameDescription
Base ElementSetVisibleSets element visibility
booleanIsVisibleReturns if element is visible
Base ElementSetAlphaSets element alpha
numberGetAlphaReturns element alpha
Base ElementSetPositionSets element position
number, numberGetPositionReturns element position
Base ElementSetSizeSets element size
number, numberGetSizeReturns element size
Base ElementSetAlignmentSets element alignment
stringGetAlignmentGets element alignment
SubscribeSubscribes to an event
UnsubscribeUnsubscribes from a event

SetVisible​

Sets the visibility of the element

Returns the Base Element (self)

element:SetVisible(false)
TypeParameterDefault ValueDescription
booleanvisibleWhether its visible

IsVisible​

Returns boolean whether its visible

if element:IsVisible() then
Package.Log("Element is visible")
else
Package.Log("Element is invisible")
end

SetAlpha​

Sets element alpha

Returns the Base Element (self)

element:SetAlpha(0.5)
TypeParameterDefault ValueDescription
numberalphaAlpha value between 0 and 1

GetAlpha​

Gets current element alpha

Returns the current alpha as a number between 0 and 1

local alpha = element:GetAlpha()

SetPosition​

Sets element position

Returns the Base Element (self)

element:SetPosition(50, 50)
TypeParameterDefault ValueDescription
numberposXX position of the element
numberposYY position of the element

GetPosition​

Gets element position

Returns two number values (posX, posY)

local posX, posY = element:GetPosition()

SetSize​

Sets element size

Returns the Base Element (self)

element:SetSize(50, 50)
TypeParameterDefault ValueDescription
numberwidthwidth of the element
numberheightheight of the element

GetSize​

Gets element size

Returns two number values (width, height)

local width, height = element:GetSize()

SetAlignment​

Sets element alignment

Returns the Base Element (self)

element:SetAlignment(EGUI.Alignment.BottomLeft)
TypeParameterDefault ValueDescription
Alignmentalignmentalignment of the element

GetAlignment​

Gets element alignment

Returns string of the alignemnt

local alignment = element:GetAlignment()

Subscribe​

Subscribes to an event

TypeParameterDefault ValueDescription
stringeventName of the event
functionhandlerFunction which handles the event

Unsubscribe​

Unsubscribes from a event

If handler is nil then all handlers for this event will be unsubscribed.

TypeParameterDefault ValueDescription
stringeventName of the event
functionhandlernilFunction which handles the event