grandMA3 User Manual Publication

Addr(handle[, handle[, boolean]])

grandMA3 User Manual » Plugins » Lua Functions - Object API » Addr(handle[, handle[, boolean]])
Version 2.0

Description

The Addr 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. This is the handle to the object where the address is requested.
    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.

     

  • Handle (optional):
    The returned address is from the root as a default. This optional handle can specify a different base location. It must still be a base location in the address path from the root to the object.
  • Boolean (optional):
    This can be useful if there is a difference between the ToAddr() and Addr(). Setting this to "true" uses the index number from the ToAddr() instead of the Addr() index number. See the example below.

    The ToAddr() object function returns the address as a text string using names. Learn more in the ToAddr() topic.

Return

  • String:
    Text string with the address in a parent-child number format separated by dots.

Example

This example prints different versions of the address to a cue in a sequence:

Lua
return function()
-- Creates a cue in sequence 1
Cmd("Store Sequence 1 Cue 100 /Merge /NoConfirmation")
--Store a handle to the created cue
local cueObject = ObjectList("Sequence 1 Cue 100")[1]
--Print different version of the handle address
Printf("ToAddr: " .. cueObject:ToAddr())
Printf("Addr: " .. cueObject:Addr())
Printf("Addr(Parent, false): " .. cueObject:Addr(cueObject:Parent(), false))
Printf("Addr(Parent, true): " .. cueObject:Addr(cueObject:Parent(), true))
end