Options
All
  • Public
  • Public/Protected
  • All
Menu

VariablesContainer stores variables, usually for a a RuntimeGame, a RuntimeScene or a RuntimeObject.

Hierarchy

  • VariablesContainer

Index

Methods

  • add(name: string, newVariable: Variable): void
  • Get a variable using its index. If you're unsure about how to use this method, prefer to use get. The index of a variable is its index in the data passed to initFrom.

    This method is generally used by events generated code to increase lookup speed for variables.

    Parameters

    • id: number

      The variable index

    Returns Variable

    The specified variable. If not found, an empty variable is added to the container, but it should not happen.

  • getNetworkSyncData(syncOptions: GetNetworkSyncDataOptions): VariableNetworkSyncData[]
  • getStructureNetworkSyncData(variable: Variable): undefined | VariableNetworkSyncData[]
  • getVariableNameInContainerByLoopingThroughAllVariables(variable: Variable): null | string
  • has(name: string): boolean
  • hasVariable(variable: Variable): boolean
  • initFrom(data: Readonly<{ children?: Readonly<{ name?: string | undefined; value?: string | number | boolean | undefined; children?: Readonly<...>[] | undefined; type?: VariableType | undefined; }>[]; name?: string; type?: VariableType; value?: string | number | boolean }>[], keepOldVariables?: Boolean): void
  • Initialize variables from a container data.
    If keepOldVariables is set to false (by default), all already existing variables will be erased, but the new variables will be accessible thanks to getFromIndex.
    if keepOldVariables is set to true, already existing variables won't be erased and will be still accessible thanks to getFromIndex.

    Parameters

    • data: Readonly<{ children?: Readonly<{ name?: string | undefined; value?: string | number | boolean | undefined; children?: Readonly<...>[] | undefined; type?: VariableType | undefined; }>[]; name?: string; type?: VariableType; value?: string | number | boolean }>[]

      The array containing data used to initialize variables.

    • Optional keepOldVariables: Boolean

    Returns void

  • rebuildIndexFrom(data: Readonly<{ children?: Readonly<{ name?: string | undefined; value?: string | number | boolean | undefined; children?: Readonly<...>[] | undefined; type?: VariableType | undefined; }>[]; name?: string; type?: VariableType; value?: string | number | boolean }>[]): void
  • Parameters

    • data: Readonly<{ children?: Readonly<{ name?: string | undefined; value?: string | number | boolean | undefined; children?: Readonly<...>[] | undefined; type?: VariableType | undefined; }>[]; name?: string; type?: VariableType; value?: string | number | boolean }>[]

    Returns void

  • remove(name: string): void
  • Remove a variable. (the variable is not really removed from the container to avoid creating garbage, but marked as undefined)

    Parameters

    • name: string

      Variable to be removed

    Returns void

  • updateFromNetworkSyncData(networkSyncData: VariableNetworkSyncData[]): void

Properties

badVariable: Variable = ...

"Bad" variable, used by events when no other valid variable can be found. This variable has no state and always return 0 or the empty string.

static
badVariablesContainer: VariablesContainer = ...

"Bad" variable container, used by events when no other valid container can be found. This container has no state and always returns the bad variable ( see VariablesContainer.badVariable ).

static

Constructors

  • new VariablesContainer(initialVariablesData?: Readonly<{ children?: Readonly<{ name?: string | undefined; value?: string | number | boolean | undefined; children?: Readonly<...>[] | undefined; type?: VariableType | undefined; }>[]; name?: string; type?: VariableType; value?: string | number | boolean }>[]): VariablesContainer
  • Parameters

    • Optional initialVariablesData: Readonly<{ children?: Readonly<{ name?: string | undefined; value?: string | number | boolean | undefined; children?: Readonly<...>[] | undefined; type?: VariableType | undefined; }>[]; name?: string; type?: VariableType; value?: string | number | boolean }>[]

    Returns VariablesContainer

Generated using TypeDoc