This function returns whether the given argument is callable, i.e. is a method or refers to an index of a function.
A function index can refer to either a built-in function, a Script Function or a Script Asset.
NOTE To only check if a value is a method, see is_method.
is_callable(n);
Argument | Type | Description |
---|---|---|
n | Any | The value to check |
function my_function()
{
return random(10);
}
my_method = function()
{
return "Hello World!";
}
show_debug_message(is_callable(my_function));
show_debug_message(is_callable(my_method));
show_debug_message(is_callable(draw_text));
The above code first defines a function my_function and a method my_method. It then shows three debug messages. Each shows the result of calling is_callable: the first on my_function, the second on my_method and the third on the built-in draw_text. All three debug messages will show 1, as all three are callable.