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. See the examples below.

Return

  • Address:
    String with the address value.

Example

These two examples return the address of the first sequence of the selected data pool and create a grandMA3 command with a "Go" keyword in front of the address. This command is sent to the grandMA3 command line.

First example using the colon operator:

Lua
return function()
-- Stores the handle in a variable.
local mySequence = DataPool().Sequences[1]
-- Converts the handle to the address and store in variable.
local mySequenceAddress = mySequence:ToAddr()
-- Send a 'Go' command with the address appended.
Cmd("Go %s", mySequenceAddress)
end

The second example uses a handle as an argument with the same result:

Lua
return function()
-- Stores the handle in a variable.
local mySequence = DataPool().Sequences[1]
-- Converts the handle to the address and store in variable.
local mySequenceAddress = ToAddr(mySequence)
-- Send a go command with the address appended.
Cmd("Go %s", mySequenceAddress)
end