SelectionFirst()
Description
Section titled âDescriptionâThe SelectionFirst Lua function returns a set of integers for the selectionâs first fixture. It is the patch index number and the XYZ grid values in the selection grid.
It is not required to use all four returned integers, but they are returned in order.
Arguments
Section titled âArgumentsâThis function does not accept any arguments.
- Integer:
The returned number is the patch index of the first fixture in the current selection. It is not the FID or CID. The index is 0-based. - Integer:
The returned number is the current position on the X-axis in the selection grid. The selection grid is 0-based. - Integer:
The returned number is the current position on the Y-axis in the selection grid. The selection grid is 0-based. - Integer:
The returned number is the current position on the Z-axis in the selection grid. The selection grid is 0-based.
Example
Section titled âExampleâThis example prints the returned numbers of the first fixture in the selection, to the Command Line History:
| Copy CodeLua |
| ``` |
| return function() |
-- Store the return in a local variablelocal fixtureIndex, gridX, gridY, gridZ = SelectionFirst();
-- Cancel the plugin if no fixture is selectedassert(fixtureIndex,"Please select a fixture and try again.");
-- Print the index number of the first fixture in the selectionPrintf("First selected fixture has index number: "..fixtureIndex .." and gridX value: "..gridX .." and gridY value: "..gridY .." and gridZ value: "..gridZ);end
### Related Functions
- [SelectionNext](/grandma3/2-4/lua_objectfree_selectionnext/)- [GetSubfixture](/grandma3/2-4/lua_objectfree_getsubfixture/)- [GetSubFixtureCount](/grandma3/2-4/lua_objectfree_getsubfixturecount/)