/ HALion Developer Resource / HALion Script / Reference /

getLayer

getLayer(nameOrPosition)

Description

Function to retrieve the Layer object of a layer in the specified layer. For example, this.parent specifies the parent layer of the script module as the layer to be searched in. The function does not search in sublayers. A particular layer can be searched by name or position. The position is the number indexing the layers in the specified layer. If several layers share the same name, only the first match will be returned. If no argument is set, the function returns the first layer it finds.

Available in: Controller, Processor.

Arguments

ArgumentDescriptionValue Type
nameOrPositionThe name or position of the layer. Set this to nil to deactivate the search filter.string or number, optional

Return Values

Returns the Layer object of the found layer. Returns nil if no layer is found.

Example

-- Locate the first layer in the program and print its name.

layer = this.program:getLayer()
 
if layer then
    print(layer.name)
else
    print("Could not find a layer!")
end

See also: getBus, getChild, getEffect, getMidiModule, getSlot, getZone, Layer