---
metadata:
  - name: generator
    content: Diplodoc Platform v5.57.3
alternate:
  - https://yandex.com/dev/games/doc/en/sdk/defold/environment.md
  - https://yandex.com/dev/games/doc/hi/sdk/defold/environment.md
  - https://yandex.com/dev/games/doc/ko/sdk/defold/environment.md
  - https://yandex.com/dev/games/doc/ru/sdk/defold/environment.md
  - https://yandex.com/dev/games/doc/tr/sdk/defold/environment.md
  - https://yandex.com/dev/games/doc/vi/sdk/defold/environment.md
  - https://yandex.com/dev/games/doc/zh/sdk/defold/environment.md
  - href: en/sdk/defold/environment.md
    type: text/markdown
    title: Markdown version
  - href: ../../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com/dev/games/doc/en/llms.txt

# Environment variables

<!-- source: en/_includes/script-common.md -->
<!-- source: en/_includes/script/index-js.md -->

<!-- endsource: en/_includes/script/index-js.md -->

<!-- source: en/_includes/script/requirements-js.md -->

<!-- endsource: en/_includes/script/requirements-js.md -->

<!-- source: en/_includes/script/image-modal-js.md -->

<!-- endsource: en/_includes/script/image-modal-js.md -->
<!-- endsource: en/_includes/script-common.md -->

You can get information about the environment the game is run in. To do this, use the `ysdk.environment` object.

```lua showLineNumbers
{
  app: {
    id: string
  },
  browser: {
    lang: string
  },
  i18n: {
    lang: string;
    tld: string;
  },
  payload: string|nil;
}
```

## Environment object {#environment-object}

Contains game environment variables.

#|
|| **Parameter** | **Type** | **Description** ||
|| `app` | table | Game data. ||
|| `browser` | table | Browser data. ||
|| `i18n` | table | Service internationalization. ||
|| `payload` | string\|nil | The value of the `payload` parameter from the game's address. Optional parameter. For example, in `https://yandex.ru/games/app/123?payload=test` you can return `test` as follows: `ysdk.environment.payload`. ||
|#

### App structure {#app-structure}

#|
|| **Parameter** | **Type** | **Description** ||
|| `id` | string | Game ID. ||
|#

### Browser structure {#browser-structure}

#|
|| **Parameter** | **Type** | **Description** ||
|| `lang` | string | Priority browser language in ISO 639-1 format. ||
|#

### i18n structure {#i18n-structure}

#|
|| **Parameter** | **Type** | **Description** ||
|| `lang` | string | [Yandex Games interface language](https://yandex.com/dev/games/doc/en/concepts/languages-and-domains.md#languages) in ISO 639-1 format. For example, `"tr"` means that the game is currently running under the Yandex Games Turkish interface. Use this parameter to determine the user's language in the game. ||
|| `tld` | string | Top-level domain. For example, `"com"` means that the game is currently running on the international domain of Yandex Games. When hosting the game on your own domain, ensure that it properly opens on any yandex domain. ||
|#

---



<!-- source: en/_includes/button-git.md -->
<a href="https://github.com/yandex-games-plugins/defold">
  <span class="button">Repository</span>
</a>
<!-- endsource: en/_includes/button-git.md -->
