SetVarMetadata

(Engine-Level Function)

Description: Every variable object contains an embedded value. This function is used to set those values.
Warning: This statement should be used by advanced users only.
Returns: Nothing
Usage: Script Only.
Function Groups: Dictionary
Related to: GetVarMetadata | FindVariable | AddVariable
Format: SetVarMetadata(Variable, Value)
Parameters:  
Variable
Required. A Variable handle, such as would be returned from the FindVariable or AddVariable functions.
Value
Required. Any value to store within the variable’s metadata.
Comments: Commonly used in conjunction with SetVarMetadata, FindVariable or AddVariable. Note that type data for each variable is stored within the variable using metadata.

Example:

<
TestMod
[
  X;
  Y;
  Var;
]
Main [
  If ! Valid(X);
  [
    X = "This is the value of X"
    Var = FindVariable("X", Self(), 0, 0);
    SetVarMetadata(Var, "This is the metadata in variable X");
    Y = GetVarMetadata(Var);
  ]
  ZText(50, 100, Concat("X: ", X), 14, 0);
  ZText(50, 120, Concat("Y: ", Y), 14, 0);
]
>