is_undefined

Returns whether the given argument is undefined or not.

Syntax:

is_undefined(n);


Argument Description
n The argument to check.


Returns: Boolean


Description

This function returns whether a given variable is defined or not. In some cases you want to check and see what data type a variable holds in GameMaker: Studio and that's when you would use this function. It returns true or false depending on whether the value is defined or not. For further information on data types see here.


Example:

var val = ds_map_find_value(map, 13);
if is_undefined(val)
   {
   show_debug_message("Map entry does not exist!");
   }

The above code checks the variable "val" to see if it is undefined or not and shows a debug message if it is.


Back: Data Types
Next: is_string
© Copyright YoYo Games Ltd. 2018 All Rights Reserved