GetPathType(handle[, integer])

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

説明

GetPathType 関数は、パスタイプの名前を含む文字列を返します。この関数は、オブジェクトをインポートするときに役立ちます。

引数

  • handle:
    ハンドルは、パスタイプが必要なオブジェクト・タイプと一致する必要があります。
  • integer (オプション):
    オプションの整数を用いて、返される文字列が User または System パスタイプと一致するかを指定できます(以下の例を参照)。
    Enums.PathContentType を用いるか、System パスの場合は 0、User パスの場合は 1 を用います。

戻り値

  • string:
    パスタイプの名前を返します。

この例では、最初のマクロ・オブジェクトのパスタイプ名(存在する場合)を出力します。

Lua
return function ()
-- Get a handle to the first Macro.
local myMacro = DataPool().Macros[1]
if myMacro == nil then
ErrPrintf("An error occurred, possibly because the first macro does not exist.")
ErrPrintf("Please create one and try again.")
return
end
-- Get the user name of the path type.
local myPathTypeNameUser = GetPathType(myMacro, Enums.PathContentType.User)
if myPathTypeNameUser ~= nil then
Printf("The user name of the path type is: " .. myPathTypeNameUser)
else
ErrPrintf("There was an error getting the path type.")
end

-- Get the system name of the path type.
local myPathTypeNameSystem = GetPathType(myMacro, Enums.PathContentType.System)
if myPathTypeNameSystem ~= nil then
Printf("The system name of the path type is: " .. myPathTypeNameSystem)
else
ErrPrintf("There was an error getting the path type.")
end
end