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

# getconnections

> 返回 RBXScriptSignal 的 RealConnection closures array table。第一个 argument 必须是 Luau type name 为 RBXScriptSignal 的 object。function 会读取 signal 的 Connect method，连接 temporary blank callback，从临时 connection 的 next reference 开始读取 linked list，断开临时 connection，并包装每个有效的 connection reference。如果临时 connection 后没有找到 connection reference，则返回空 table。以前包装过的 underlying references 可能返回同一个 cached closure table。getsignals 和 get_signal_cons 是同一个 function 的 aliases。

<div className="real-function-page">
  ```lua theme={null}
  getconnections(signal: RBXScriptSignal): {RealConnection}
  ```

  ## 别名

  * `getsignals`
  * `get_signal_cons`

  ## 参数

  <ParamField path={"signal"} type={"RBXScriptSignal"} required>
    要检查的 signal。非 RBXScriptSignal object 会抛出 type error，没有可调用 Connect field 的 signal 会抛出 "Signal does not have 'Connect' method"。
  </ParamField>

  ## 返回值

  <ResponseField name={"connections"} type={"{RealConnection}"}>
    connection closure tables 的 array table。每个 closure 通过其 methods 暴露 fields 和 methods，包括可用时的 Enabled, Disabled, LuaConnection, ForeignState, Function, Thread, Disconnect, Disable, Enable, Fire 和 Defer。
  </ResponseField>

  ## 示例

  Inspect an RBXScriptSignal and list the wrapped connections Real can expose.

  ```lua theme={null}
  local Players = game:GetService("Players")

  for _, connection in ipairs(getconnections(Players.PlayerAdded)) do
      print(connection.Enabled, connection.LuaConnection)
  end
  ```
</div>
