---
metadata:
  - name: generator
    content: Diplodoc Platform v5.66.0
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: https://yandex.com/dev/games/doc/en/sdk/defold/environment.md
    type: text/markdown
    title: Markdown version
  - href: https://yandex.com/dev/games/doc/en/llms.txt?revision=r21993288
    rel: describedby
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com/dev/games/doc/en/llms.txt?revision=r21993288

# 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
    },
    i18n: {
        lang: string
    },
    payload: string|nil
}
```

## Environment object {#environment-object}

Contains game environment variables.

#|
|| **Parameter** | **Type** | **Description** ||
|| `app` | `table` | Game 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. ||
|#


### 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) in ISO 639-1 format. For example, `"tr"` means that the game is currently running in the Turkish interface of Yandex Games. Use this parameter to automatically detect the user's language in the game ([item 2.14](https://yandex.com/dev/games/doc/en/concepts/requirements.md#2-14)).
 ||
|#

---


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