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

getBus(nameOrPosition)

Description

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

Available in: Controller, Processor.

Arguments

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

Return Values

Returns the Bus object of the found bus. Returns nil if no bus is found. 

Example

-- locate the first bus in the program and print its name
bus = this.program:getBus()

if bus then
    print(bus.name)
else
    print("Could not find a bus!")
end

3 Comments

    1. Please reread. Thanks!