grandMA3 User Manual Publication

ToAddr(handle)

grandMA3 User Manual » Plugins » Lua Functions - Object API » ToAddr(handle)
Version 2.0

Description

The ToAddr Lua object function converts a handle to an address string that can be used in commands.

See the Handle topic for more info regarding handles and links to other related functions.

Arguments

  • Handle:
    The function takes a handle of the type "light_userdata" as an argument.
    It can be omitted when using the colon notation on an object.

    The Colon Notation is a way to omit the handle as the first argument when using the Object functions.

    This is the general syntax with the colon notation: object:function()

    This is the general syntax with standard handle notation: object.function(object)

    Learn more in the Lua Functions - Object API topic.

Return

  • String:
    Text string with the address.

Example

This example returns the address of the first sequence of the selected data pool, prints the address in the Command Line History, and creates a grandMA3 command with a "Go" keyword in front of the address. This command is sent to the grandMA3 command line.

The command line history shows the commands entered and how the system interprets the command and feedback. Learn more in the Command Line topic.

Lua
return function()
-- Stores the handle in a variable.
local mySequence = DataPool().Sequences[1]
if mySequence ~= nil then
-- Converts the handle to the address and store in variable.
local mySequenceAddress = mySequence:ToAddr()
-- Print the address to the Command Line History.
Printf("The address of the sequence is: " .. mySequenceAddress)
-- Send a 'Go' command with the address appended.
Cmd("Go %s", mySequenceAddress)
else
ErrPrintf("The sequence could not be found")
end
end