variable_global_exists

Check to see if a given global variable exists

Syntax:

variable_global_exists(name);


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


Returns: Value (any data type) or undefined (if the named variable does not exist)


Description

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


Example:

if variable_global_exists("enemy_num")
   {
   show_debug_message("enemy_num = " + string(variable_global_get("enemy_num"));)
   }

The above code will check to see if a global variable exists and if it does then it is output to the console.


Back: Variables And Variable Scope
Next: variable_global_set
© Copyright YoYo Games Ltd. 2018 All Rights Reserved