ExportCSV(filename, export_data)

grandMA3 ユーザマニュアル » プラグイン » Lua 関数 - Object-Free API » ExportCSV(filename, export_data) Version 2.2

説明

ExportCSV 関数は、Lua のテーブルをCSV形式でエクスポートします。

既知の制限:
出力CSVファイルが正しくフォーマットされていない可能性があります。

引数

  • filename:
    エクスポートされるファイルの名前を指定する文字列です。ファイル名には、パス全体が含まれている必要があります(後述の例を参照)。
  • export_data:
    エクスポートされるデータです。テーブル・オブジェクトである必要があります。

戻り値

  • boolean:
    以下の boolean 値を返します。
    • true:
      エクスポートに成功しました。
    • false:
      エクスポートに失敗しました。

ビルドの詳細テーブルをエクスポートするには、以下のようなコードでプラグインを作成します。

Lua
return function()
-- 'BuildDetails()' creates a table with information about the software build.
local build = BuildDetails()
--The path and filename is stored in a variable.
local exportPath = GetPath(Enums.PathType.Library) .. "/BuildDetails.csv"
--The actual export (in csv format) using the path and the table - the result boolean stored in a variable.
local success = ExportCSV(exportPath, build)
--Print feedback about the export path.
if success then
Printf("The export was stored at: " .. exportPath)
else
Printf("The export failed.")
end
end