Meteor 2 Scripting Functions
Var
variant getVar(int objectID, string name, variant defaultValue)
Get a named variable value from an object.

Example
bool isPlayer = getVar(getLocalPlayerObject(), "is_player", false);
if(isPlayer)
{
    print("Is a player");
}

Comments
A variant can be a bool, int, float, string or vector2.

See also
setVar getVarNames

void setVar(int objectID, string name, variant value, bool netSync)
Set a named variable value to an object.

Example
// set "is_player" to true and sync across network
setVar(getLocalPlayerObject(), "is_player", true, true);

Comments
A variant can be a bool, int, float, string or vector2.

See also
getVar

array getVarNames(int objectID)
Get an array with all the variable names from an object.

Example
// print all variables from an object
int objectID = getLocalPlayerObject();
array<string> varNames = getVarNames(objectID);
for (uint i = 0; i < varNames.length(); i++)
{
    variant varValue = getVar(objectID, varNames[i], "");
    print(varNames[i] + " = " + varValue);
}

See also
getVar


Index