grandMA3 User Manual Publication

FromAddr(string[, handle])

grandMA3 User Manual » Plugins » Lua Functions - Object-Free API » FromAddr(string[, handle])
Version 2.1

Description

The FromAddr Lua function converts a numbered string address into a handle that can be used in commands.

Arguments

  • String:
    A text string identifying an object. It can be a numbered or named address.
  • Handle (optional):
    The default is to write the address from the root location. This optional handle can specify a different base location. It still needs to be a base location in the address path from the root to the object.

Return

  • Handle:
    The handle for the addressed object.

Example

This example prints the address of the first sequence:

Lua
return function()
-- Converts the string to a handle and store in a variabel.
local mySequenceHandle = FromAddr("13.13.1.5.1")
-- Converts the handle back to a numbered string and prints it.
Printf("The address is: " ..mySequenceHandle:Addr())
-- Converts the handle to a named string and prints it.
Printf("The address is: " ..mySequenceHandle:AddrNative())

-- Store the handle of the selected datapool.
local myDataPool = DataPool()
-- Prints the address of the selected datapool.
Printf("The datapool address is: " ..myDataPool:Addr())

--- The follwoing example uses the name of a sequence in the sequence pool.
--- Please adjust the "Default" name in the next line to match an existing named sequence.
-- Finds the address based on the base location and a text string with names.
local alsoMySequenceHandle = FromAddr("Sequences.Default", myDataPool)
-- Converts the handle back to a numbered string and prints it.
Printf("The address is: " ..alsoMySequenceHandle:Addr())
-- Converts the handle to a named string and prints it.
Printf("The address is: " ..alsoMySequenceHandle:AddrNative())
end