> For the complete documentation index, see [llms.txt](https://lfdocs.lookingglassfactory.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lfdocs.lookingglassfactory.com/legacy/legacy-software/core-sdk/index-1/index/state-functions.md).

# State Functions

The following functions are used to manage the lifecycle of the HoloPlay Core application.

## hpc\_InitializeApp

`hpc_client_error hpc_InitializeApp(const char *app_name, hpc_license_type app_type)`

**Returns**

Error code returned from HoloPlay Service request.

**Args**

Name of application (will be registered by HoloPlay Service) and application commercial licensing type (see [hpc\_license\_type](/legacy/legacy-software/core-sdk/index-1/libholoplaycore.md#hpc_license_type)).

**Description**

Registers a client app with HoloPlay Service, and updates the global state variable. If you intend to register an app under a specific name, this **must** be the first function call you make.

## hpc\_RefreshState

`hpc_client_error hpc_RefreshState(void)`

**Returns**

void

**Args**

none

**Description**

Send a new message to HoloPlayService requesting updated device information; overwrite the state variable storing that information. hpc\_InitializeApp will initially populate this variable. Call this function again to update that variable.

## hpc\_CloseApp

`int hpc_CloseApp(void)`

**Returns**

error code returned from HoloPlay Service request.

**Args**

none

**Description**

Closes connection to HoloPlay Service. This should *always* be called before your app exits.

## hpc\_GetHoloPlayCoreVersion

`size_t hpc_GetHoloPlayCoreVersion(char *out_buf, size_t out_buf_sz)`

**Returns**

Current version of HoloPlay Core, as a string.

**Args**

none


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://lfdocs.lookingglassfactory.com/legacy/legacy-software/core-sdk/index-1/index/state-functions.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
