/ HALion Developer Resource / HALion Script / Reference /

findBusses

findBusses(recursive, nameOrFilterFunction)

Description

Function to find busses in the specified Element object. For example, this.parent specifies the parent of the script module as the Element object to be searched in. If recursive is set to true, subelements will also be searched. The function returns an array with the Bus objects of the found busses. Particular busses can be searched by name or via a filter function. If searching by name, findBusses accepts only the Bus objects that match the specified name. The filter function uses the Bus object of each bus as argument. Only those Bus objects that return true for the search criteria defined in the filter function will be accepted by findBusses. Without a name or filter function, the Bus objects of all busses in the searched Element obects will be returned.

Available in: Controller, Processor.

Arguments

ArgumentDescriptionValue Type
recursiveIf this is set to false, only the specified Element object will be searched. If this is set to true, subelements will also be searched. The default is false.boolean
nameOrFilterFunctionThe name of the busses searched for or a filter function. Only the Bus 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 Bus objects of the found busses. Returns an empty table if no busses are found.

Example

-- Find all busses and print their names.
busses = this.program:findBusses(true)
 
if busses[1] then
    for i, bus in ipairs(busses) do
        print(bus.name)
    end
else
    print("Could not find any busses!")
end

See also: findChildren, findEffects, findLayers, findMidiModules, findSlots, findZones, Bus