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: Boolean


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")) global.enemy_num = instance_number(obj_Enemey_Parent);

The above code will check to see if the global variable called "enemy_num" exists and if it does not it is created and set a value.


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