GetRTChannels(integer[,boolean] OR handle[,boolean])

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

説明

GetRTChannels 関数は、RTチャンネルのインデックスまたはRTチャンネル・オブジェクトへのハンドルを含むテーブルを返します。この関数には、2種類の引数があります。

引数

  • integer:
    (サブ)フィクスチャのインデックス番号です。
  • boolean (オプション):
    • true:
      返されるテーブルには、RTチャンネル・オブジェクトのハンドルが含まれます。
    • false (デフォルト):
      返されるテーブルには、RTチャンネル・オブジェクトのインデックス番号が含まれます。

― または ―

  • handle:
    (サブ)フィクスチャへのハンドルです。
  • boolean (オプション):
    • true:
      返されるテーブルには、RTチャンネル・オブジェクトのハンドルが含まれます。
    • false (デフォルト):
      返されるテーブルには、RTチャンネル・オブジェクトのインデックス番号が含まれます。

戻り値

  • table:
    返されるテーブルは、RTチャンネル・インデックスまたは同じRTチャンネル・インデックスへのハンドルのリストです。

例1

セレクション内の最初のフィクスチャに対するRTチャンネル・インデックスのリストを出力します。入力にはインデックス番号を用います。

Lua
return function()
    -- Get the index number for the first fixture in the current selection 
    local fixtureIndex = SelectionFirst()
    -- Get the indexes of the RT channels
    local rtChannels = GetRTChannels(fixtureIndex, false)
    -- Print an error message if returnd table is nil
    if rtChannels == nil then
        ErrPrintf("Please select a fixture and try again")
        return
    end
    -- Print the table content
    for key,value in ipairs(rtChannels) do
        Printf("List index number ".. key .." : RTChannel index number = ".. value)
    end
end

例2

セレクション内の最初のフィクスチャに対するRTチャンネルのインデックスとアトリビュートのリストを出力します。入力にはハンドルを用います。

Lua
return function()
    -- Get a handle to the first fixture in the current selection
    local fixtureHandle = GetSubfixture(SelectionFirst())
    if fixtureHandle == nil then
        ErrPrintf("Please select a fixture and try again")
        return
    end
    -- Creates a table of handles to the RT channels of the first selected fixture.
    local rtChannels = GetRTChannels(fixtureHandle, true)
    if rtChannels == nil then
        ErrPrintf("Please select a fixture and try again")
        return
    end
    -- Print DMX addresses of the RT Channels for the fixture
    for key,value in ipairs(rtChannels) do
        Printf("List index number ".. key .. ": RTChannel Index = %i, Coarse DMX addr. = %s, Fine DMX addr. = %s", value.INDEX, value.COARSE, value.FINE)
    end
end