GetChannelFunction(integer, integer)
Description
Section titled “Description”The GetChannelFunction Lua function returns a handle to a channel function based on two index inputs.
Arguments
Section titled “Arguments”- Integer:
The first integer is a UI Channel Index. This can be found in the Parameter List or by the GetUIChannelIndex() Lua function. - Integer:
This integer is an Attribute Index (0-based). This can be found in the Attribute Definitions or by the GetAttributeIndex() Lua function.
Return
Section titled “Return”- Handle:
The returned handle to the channel function.
Example
Section titled “Example”This example prints the data connected to the handle. It uses the Dump() function:
Dump()
Section titled “Dump()”The Dump() function returns a string with information about the object, for instance, the name, class, path of the object, its properties, and children.
Learn more in the Dump() topic.
| Copy CodeLua |
| ``` |
| return function() |
-- Select the first fixture in the current selection.local subfixtureIndex = SelectionFirst()-- End the function if there is no selection.if subfixtureIndex == nil then ErrPrintf("Please select a fixture with a Dimmer") returnend-- Get the Attribute index and UIChannel index.local attributeIndex = GetAttributeIndex("Dimmer")local uiChannelIndex = GetUIChannelIndex(subfixtureIndex,attributeIndex)Printf("The UIChannel Index is: %i. The Attribute Index is: %i. ",uiChannelIndex, attributeIndex)-- End the function if any of the index return nil.if (attributeIndex == nil or uiChannelIndex == nil) then ErrPrintf("Something wrong happened, maybe your first selected fixture don't have a Dimmer - Please try again") returnend-- The following prints the dump for the dimmer channel function.Printf("=============== START OF DUMP ===============")GetChannelFunction(uiChannelIndex,attributeIndex):Dump()Printf("================ END OF DUMP ================")end