grandMA3 User Manual Publication

SelectionFirst()

grandMA3 User Manual » Plugins » Lua Functions - Object-Free API » SelectionFirst()
Version 2.0

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

This function does not accept any arguments.

Return

  • 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

This example prints the returned numbers of the first fixture in the selection, to the Command Line History:

Lua
return function()
-- Store the return in a local variable
local fixtureIndex, gridX, gridY, gridZ = SelectionFirst();

-- Cancel the plugin if no fixture is selected
assert(fixtureIndex,"Please select a fixture and try again.");

-- Print the index number of the first fixture in the selection
Printf("First selected fixture has index number: "..fixtureIndex
.." and gridX value: "..gridX
.." and gridY value: "..gridY
.." and gridZ value: "..gridZ);
end

Related Functions