> ## 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.

# getactorfromthread

> 返回与 Luau thread 关联的 Actor Instance。第一个 argument 必须是 thread。function 会读取该 thread 的 thread data，要求存在 Actor reference 且 container count 为 positive，然后读取 the associated Actor。如果 actor weak reference 有效，就作为 Instance push；否则 function 返回 nil。

<div className="real-function-page">
  ```lua theme={null}
  getactorfromthread(thread: thread): Instance | nil
  ```

  ## 别名

  * `getactorfromstate`

  ## 参数

  <ParamField path={"thread"} type={"thread"} required>
    要检查其 thread data 中 associated Actor weak reference 的 Luau thread。
  </ParamField>

  ## 返回值

  <ResponseField name={"actor"} type={"Instance | nil"}>
    从 thread 的 the associated Actor weak reference 解析出的 Actor Instance，或在没有 valid actor reference 时返回 nil。
  </ResponseField>

  ## 示例

  Resolve the Actor Instance associated with a Luau thread, when that thread has a valid actor reference.

  ```lua theme={null}
  for _, thread in ipairs(getactorthreads()) do
      local actor = getactorfromthread(thread)
      print(actor)
  end
  ```
</div>
