/ HALion Developer Resource / HALion Script / Reference /

getElement

getElement()

Description

Function to obtain the Element object of an element that has a macro page. If you call this function in the UI script of a macro page, the Element object of the element to which the macro page is attached will be returned. Depending on the element, the returned object can be of the type program, layer, or MIDI module, for example.

❕ This function can only be called in an UI script.

Available in: UI.

Return Values

Returns the Element object of the element to which the macro page is attached.

Example

-- Must be executed as UI script!
-- Print the name and type of the element that has the macro page attached.

element = getElement()
print(element.name, element.type)

-- Print the name and type of the parent element.

if element.parent then
    print(element.parent.name, element.parent.type)
end