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- Pick a release from megalanthus/defold-gamepush releases and add its Source code (zip) URL (or a packaged
.zipasset, if the library ships one) togame.projectunder[project]dependencies, then Fetch Libraries in the Defold editor. - Run
bunx @defold-typescript/cli resolveto materialize its types. - Import it under a namespace alias of your choice:
import * as core_variables from "gamepush.core.variables"
- Pick a release from megalanthus/defold-gamepush releases and add its Source code (zip) URL (or a packaged
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.