Skip to Content
defold-typescript libraries
megalanthusdefold-gamepush

megalanthus/defold-gamepush/gamepush.core.variables

GamePush game variables: fetch them and read their values and types.

  • GitHub: megalanthus/defold-gamepush — pinned to v1.4.1
    1. Pick a release from megalanthus/defold-gamepush releases and add its Source code (zip) URL (or a packaged .zip asset, if the library ships one) to game.project under [project] dependencies, then Fetch Libraries in the Defold editor.
    2. Run bunx @defold-typescript/cli resolve to materialize its types.
    3. Import it under a namespace alias of your choice:
      import * as core_variables from "gamepush.core.variables"

Functions

fetch(callback?: () => void)

Fetches the game variables.

Parameters

  • callback?: () => void — Called when the fetch finishes.

get(variable: string): unknown

The value of variable. Raises unless variable is a string.

Parameters

  • variable: string

Returns

  • unknown

has(variable: string): boolean

Whether variable exists. Raises unless variable is a string.

Parameters

  • variable: string

Returns

  • boolean

type(variable: string): string

The type of variable, one of the types values. Raises unless variable is a string.

Parameters

  • variable: string

Returns

  • string

Variables

types: { readonly DATA: "data"; readonly STATS: "stats"; readonly FLAG: "flag"; readonly DOC_HTML: "doc_html"; readonly IMAGE: "image"; readonly FILE: "file"; }

The variable type values type reports.

callbacks: VariablesCallbacks

The variable event handlers.

Types

VariablesCallbacks

VariablesCallbacks.fetch?: () => void

The variables were fetched.

VariablesCallbacks.error_fetch?: (error: unknown) => void

Fetching the variables failed.

On this page