ToAddr(handle)

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

説明

ToAddr 関数は、ハンドルを、コマンドで使用できるアドレス文字列に変換します。

ハンドルの詳細や関連関数については、ハンドル を参照してください。

引数

  • handle:
    light_userdata 型のハンドルです。オブジェクトでコロン記法を用いる場合は省略できます。
  • boolean:
    返される名前を取得するには、これを true に設定します。false に設定すると、オブジェクトタイプとインデックス番号が返されます。

戻り値

  • string:
    アドレスを表す文字列を返します。

この例では、選択したデータプールにある最初のシーケンスのアドレスを取得し、それを Command Line History に出力し、そのアドレスの前に "Go" キーワードを付けて grandMA3 コマンドを作成します。このコマンドは、grandMA3 コマンドラインに送られます。

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