Get(handle, string[, integer])

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

説明

Get 関数は、オブジェクトの名前、クラス、パスなど、指定されたプロパティに関する情報を含む文字列を返します。

引数

  • handle:
    light_userdata 型のハンドルです。オブジェクトでコロン記法を用いる場合は省略できます。
  • string:
    オブジェクトの有効なプロパティ名を表す文字列です。
  • integer (オプション):
    有効な役割を指定できます。これにより、戻り値は文字列になります。

戻り値

  • string:
    プロパティの値を返します。プロパティが boolean 値の場合、役割が指定されていない限り、戻り値は "0" または "1" です(オプション引数の integer を参照)。役割が指定されている場合は、"No" または "Yes" の値が返されます。

この例では、選択したシーケンスの Tracking プロパティに関する情報を出力します。

Lua
return function ()
-- SelectedSequence() creates a handle to the selected sequence.
local selectedSequence = SelectedSequence()
-- Check if there is a selected sequence. If not, then exit the function.
if selectedSequence == nil then
ErrPrintf("The selected sequence could not be found.")
return
end
-- Set a variable with the property name.
local propertyName = "Tracking"
-- Get the value of the property.
local propertyValue = selectedSequence:Get(propertyName)
local propertyValueString = selectedSequence:Get(propertyName, Enums.Roles.Edit)
-- Return some feedback.
if propertyValue ~= nil then
Printf("The selected sequence's property " .. propertyName.. " has the value '" .. propertyValue .. "' and a string value of '" .. propertyValueString .. "'.")
else
ErrPrintf("The property could not be found.")
end
end