grandMA3 User Manual Publication
ObjectList(string[, table])
grandMA3 User Manual » Plugins » Lua Functions - Object-Free API » ObjectList(string[, table])
Version 2.1

Description

The ObjectList Lua function returns a table with handles. The table is created based on a string input that should create a selection.

Argument

  • String:
    The string must be a command that would create a range of objects in the command line.
  • Table (optional):
    The table can contain two possible named elements. Each element can have a boolean true or false value. See the examples below for how to use them.
    • 'reverse_order':
      This must have a boolean value. If this is true then the returned list is in reverse order.
    • 'selected_as_default':
      This must have a boolean value. If this is true then the object list will only contain the object that is selected in the pool. For instance, it only returns the currently selected filter from the filter pool.

Return

  • Table:
    The function returns a table with handles to the objects based on the string argument.

Examples

This example returns the names and patch addresses of fixtures 1 through 10. It assumes these fixtures exist - if they do not, then it returns an error text.

Lua
return function()
-- Create a list of handles based on the "Fixture 1 Thru 10" selection and store it in a table.
local myObjects = ObjectList("Fixture 1 Thru 10", {reverse_order=true})
-- If the selection returned a table, then go through all elements and print information of the object.
if myObjects~= nil then
for i in pairs(myObjects) do
Printf("Fixture: " .. myObjects[i].name .. " - Patch: " ..myObjects[i].patch)
end
else
ErrPrintf("An error occured. Does Fixture 1 Thru 10 exist?")
end
end

This example creates an object list with the selected sequence. It then dumps all information about the sequence using the Dump function.

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.

Lua
return function()
-- Create a list of one handle to the selected sequence and store it to a table.
local myObjects = ObjectList("Sequence", {selected_as_default=true})
-- If the selection returned a table, then dump the first (and only) element.
if myObjects~= nil then
myObjects[1]:Dump()
else
ErrPrintf("An error occured.")
end
end