Ptr(handle, integer)

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

説明

Ptr 関数は、子オブジェクトへのハンドルを返します。

引数

  • handle:
    light_userdata 型のハンドルです。オブジェクトでコロン記法を用いる場合は省略できます。
  • Integer:
    目的の子オブジェクトのインデックス番号(1ベース)です。

戻り値

  • handle または nil:
    子オブジェクトへのハンドルを返します。存在しない場合は nil を返します。

選択したシーケンスの最初の子に接続されたデータを、Dump() 関数で出力します。

Lua
return function()
    -- SelectedSequence() creates a handle to the selected sequence.
    local selectedSequence = SelectedSequence()
    -- Check that a handle was returned - if not then exit function.
    if selectedSequence == nil then
        ErrPrintf("There is no selected sequence.")
        return
    end
    -- Get a handle to the first child object.
    local firstChild = selectedSequence:Ptr(1)
    -- Print some feedback.
    if firstChild ~= nil then
        Printf("=============== START OF DUMP ===============")
        firstChild:Dump()
        Printf("================ END OF DUMP ================")
    else
        ErrPrintf("The object do not have a child object.")
    end
end