> ## Documentation Index
> Fetch the complete documentation index at: https://docs.projectreal.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# openfilesdialog

> Windows file picker を通じて multi-select を有効にした Windows file-open dialog を開き、選択されたファイルを file item 値として返します。

<div className="real-function-page">
  ```lua theme={null}
  openfilesdialog(options?: DialogOptions): { FileSystemItem } | nil
  ```

  ## 引数

  <ParamField path={"options"} type={"DialogOptions"}>
    Optional table. openfilesdialog では title、defaultPath、extensionFilter が使用されます。extensionFilter は extension strings の table です。各 filter が \*.\<extension> になる前に、先頭の . または \*. は取り除かれます。
  </ParamField>

  ## 戻り値

  <ResponseField name={"files"} type={"{ FileSystemItem } | nil"}>
    選択されたファイルの file item 値の Array table、または dialog がキャンセルされた場合や selected filesystem paths が返されない場合は nil。Dialog failures は Failed to open file dialog を throw します。
  </ResponseField>

  ## 型

  ### DialogOptions

  ネイティブ ファイルまたはフォルダーの選択ダイアログを構成します。

  | Name               | Type                 | Required | 説明                                         |
  | ------------------ | -------------------- | -------- | ------------------------------------------ |
  | `title`            | `string`             | No       | ダイアログウィンドウのタイトルを設定します。                     |
  | `defaultPath`      | `string`             | No       | ダイアログが開いたときに表示されるディレクトリを選択します。             |
  | `extensionFilter`  | `&#123;string&#125;` | No       | 先頭のドットの有無にかかわらず、選択可能なファイルをリストされた拡張子に制限します。 |
  | `suggestedName`    | `string`             | No       | 保存ダイアログに初期ファイル名を指定します。                     |
  | `defaultExtension` | `string`             | No       | 入力したファイル名に拡張子がない場合に使用する拡張子を設定します。          |

  ## 例

  file picker を開いて 1 つ以上のファイルを選択し、それぞれの selected file item を処理します。

  ```lua theme={null}
  local files = openfilesdialog({
      title = "Choose source files",
      defaultPath = ".",
      extensionFilter = { "lua", "luau", "txt" },
  })

  if files then
      for _, file in ipairs(files) do
          print(file:GetName())
          print(file:IsFile())
      end
  else
      print("No files selected")
  end
  ```
</div>
