ToAddr(handle)

grandMA3 ユーザマニュアル » プラグイン » Lua 関数 - Object API » ToAddr(handle) Version 2.2

説明

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.

引数

  • handle:
    light_userdata 型のハンドルです。オブジェクトでコロン記法を用いる場合は省略できます(後述の例を参照)。
  • boolean:
    Set this to "true" to get the returned name. "False" will return the object type and index number.

戻り値

  • string:
    Text string with the address.

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 mySequenceAddressName = mySequence:ToAddr(true)
local mySequenceAddress = mySequence:ToAddr(false)
-- Print the address to the Command Line History.
Printf("The named address of the sequence is: " .. mySequenceAddressName)
Printf("The system 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