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

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

findZones(recursive, nameOrFilterFunction)

Description

Function to find zones in a branch. For example, this.parent defines the parent layer of the script module as branch. If recursive is set to true, subbranches will also be searched. The function returns an array with the element objects of the found zones. Particular zones can be searched by name or through a filter function. If searching by name, findZones accepts only the element objects that match the specified name. The filter function uses the element object of each zone as argument. Only those element objects that return true for the search criteria defined in the filter function will be accepted by findZones. Without a name or filter function the element objects of all zones in the searched branches will be returned.

Available in: Controller, Processor.

Arguments

recursiveIf set to false, only the current branch will be searched. If set to true, subbranches will also be searched. The default is false.boolean
nameOrFilterFunctionThe name of the zones searched for or a filter function. Only the element objects that match the name or return true for the search criteria of the filter function will be accepted. Set this to nil to deactivate any name filter or search criteria.string or function, optional

Return Values

Returns an array with the element objects of the found zones.

Example

-- find all zones and print their names
zones = this.program:findZones(true)

if zones[1] then
    for i, zone in ipairs(zones) do
        print(zone.name)
    end
else
    print("Could not find any zones!")
end

  • No labels
Write a comment…