:github_url: hide .. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the Callable.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_Callable: Callable ======== An object representing a method in a certain object that can be called. Description ----------- ``Callable`` is a first class object which can be held in variables and passed to functions. It represents a given method in an :ref:`Object`, and is typically used for signal callbacks. **Example:** :: var callable = Callable(self, "print_args") func print_args(arg1, arg2, arg3 = ""): prints(arg1, arg2, arg3) func test(): callable.call("hello", "world") # Prints "hello world". callable.call(Vector2.UP, 42, callable) # Prints "(0, -1) 42 Node(Node.gd)::print_args". callable.call("invalid") # Invalid call, should have at least 2 arguments. Methods ------- +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Callable` | :ref:`Callable` **(** :ref:`Object` object, :ref:`StringName` method_name **)** | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Variant` | :ref:`call` **(** ... **)** vararg | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`call_deferred` **(** ... **)** vararg | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`StringName` | :ref:`get_method` **(** **)** | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Object` | :ref:`get_object` **(** **)** | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_object_id` **(** **)** | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`hash` **(** **)** | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_custom` **(** **)** | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_null` **(** **)** | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_standard` **(** **)** | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ Method Descriptions ------------------- .. _class_Callable_method_Callable: - :ref:`Callable` **Callable** **(** :ref:`Object` object, :ref:`StringName` method_name **)** Creates a new ``Callable`` for the method called ``method_name`` in the specified ``object``. ---- .. _class_Callable_method_call: - :ref:`Variant` **call** **(** ... **)** vararg Calls the method represented by this ``Callable``. Arguments can be passed and should match the method's signature. ---- .. _class_Callable_method_call_deferred: - void **call_deferred** **(** ... **)** vararg Calls the method represented by this ``Callable`` in deferred mode, i.e. during the idle frame. Arguments can be passed and should match the method's signature. ---- .. _class_Callable_method_get_method: - :ref:`StringName` **get_method** **(** **)** Returns the name of the method represented by this ``Callable``. ---- .. _class_Callable_method_get_object: - :ref:`Object` **get_object** **(** **)** Returns the object on which this ``Callable`` is called. ---- .. _class_Callable_method_get_object_id: - :ref:`int` **get_object_id** **(** **)** Returns the ID of this ``Callable``'s object (see :ref:`Object.get_instance_id`). ---- .. _class_Callable_method_hash: - :ref:`int` **hash** **(** **)** ---- .. _class_Callable_method_is_custom: - :ref:`bool` **is_custom** **(** **)** ---- .. _class_Callable_method_is_null: - :ref:`bool` **is_null** **(** **)** ---- .. _class_Callable_method_is_standard: - :ref:`bool` **is_standard** **(** **)**