variable_struct_exists

With this function you can check whether a variable exists within the given struct or not. You supply the struct reference to use as well as the variable name to check for as a string (see example code below). The function will return true if a variable with the given name exists for the struct and false otherwise.

 

Syntax:

variable_struct_exists(struct, name);

Argument Description
struct The struct reference to check
name The name of the struct variable to check for (as a string)

 

Returns:

Boolean

 

Example:

if !variable_struct_exists(mystruct, "shields"))
{
mystruct.shields = 0;
}

The above code will check to see if the variable called "shields" exists in the given struct and if it does not then it is created and initialised to 0.