Page tree
Skip to end of metadata
Go to start of metadata

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

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

3 Comments

    1. Please reread. Thanks!