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

# chat_user::local function

> chat_user::local function

# chat\_user::local function

如果用户是本地用户，则返回指向与此用户关联的 [chat\_user\_local](/reference/chat/gamechat2/classes/chat_user/chat_user_local/chat_user_local) 对象的指针。

<a id="syntaxSection" />

## 语法

```cpp theme={null}
chat_user_local* local(  
)  
```

<a id="parametersSection" />

### 参数

无。

<a id="retvalSection" />

### 返回值

类型：[chat\_user\_local](/reference/chat/gamechat2/classes/chat_user/chat_user_local/chat_user_local)\*

如果用户是本地用户，则返回指向与此用户关联的 [chat\_user\_local](/reference/chat/gamechat2/classes/chat_user/chat_user_local/chat_user_local) 对象的指针；否则为 `NULL`。

<a id="remarksSection" />

## 备注

如果用户是本地用户，此方法将返回指向与此 [chat\_user](/reference/chat/gamechat2/classes/chat_user/chat_user) 对象关联的 [chat\_user\_local](/reference/chat/gamechat2/classes/chat_user/chat_user_local/chat_user_local) 对象的指针。返回的指针在关联的 `chat_user` 对象的生命周期内保持有效，即直到通过调用 [chat\_manager::remove\_user](/reference/chat/gamechat2/classes/chat_manager/methods/chat_manager_remove_user) 方法移除用户为止。有关将本地和远程用户添加到应用的本地 [chat\_manager](/reference/chat/gamechat2/classes/chat_manager/chat_manager) 实例的详细信息，请参阅[使用 Game Chat 2 C++ API](/services/xbox-services/multiplayer/chat/game-chat2/using-game-chat-2) 中的[向 Game Chat 2 添加用户](/services/xbox-services/multiplayer/chat/game-chat2/using-game-chat-2#adding_users_to_game_chat_2)部分。

<a id="requirementsSection" />

## 要求

**头文件：** GameChat2.h

**支持的平台：** Windows、XBOX One 系列主机和 XBOX Series 主机

<a id="seealsoSection" />

## 另请参阅

[Game Chat 2 简介](/services/xbox-services/multiplayer/chat/game-chat2/game-chat-2-intro)\
[chat\_user::local](/reference/chat/gamechat2/classes/chat_user/methods/chat_user_local_function-overloads)\
[chat\_user](/reference/chat/gamechat2/classes/chat_user/chat_user)


## Related topics

- [chat_user::local function - overloads](/zh-CN/reference/chat/gamechat2/classes/chat_user/methods/chat_user_local_function-overloads.md)
- [chat_user::local](/zh-CN/reference/chat/gamechat2/classes/chat_user/methods/chat_user_local_function_2.md)
- [chat_user_local::remote_user_muted](/zh-CN/reference/chat/gamechat2/classes/chat_user/chat_user_local/methods/chat_user_local_remote_user_muted.md)
- [chat_user_local::microphone_muted](/zh-CN/reference/chat/gamechat2/classes/chat_user/chat_user_local/methods/chat_user_local_microphone_muted.md)
- [chat_user_local::send_chat_text](/zh-CN/reference/chat/gamechat2/classes/chat_user/chat_user_local/methods/chat_user_local_send_chat_text.md)
