Class Object

Object metatype, wrapper for godot_object.

Fields

Object.null ((godot_object *) NULL): The null Object, useful as default values of properties.

Methods

Object:add_user_signal (signal[, arguments]) Adds a user-defined signal.
Object:call (method, ...) Calls the method on the Object and returns the result.
Object:call_deferred (method, ...) Calls the method on the Object during idle time.
Object:can_translate_messages () Returns true if the Object can translate strings.
Object:connect (signal, target, method[, binds[, flags]]) Connects a signal to a method on a target Object.
Object:disconnect (signal, target, method) Disconnects a signal from a method on the given target.
Object:emit_signal (signal, ...) Emits the given signal.
Object:free () Deletes the object from memory immediately.
Object:get (property) Returns the value of the given property.
Object:get_class () Returns the Object's class name.
Object:get_class_wrapper () Get the OOP.ClassWrapper associated with this Object's class.
Object:get_incoming_connections () Returns an Array of Dictionaries with information about signals that are connected to the Object.
Object:get_indexed (property) Gets the Object's property indexed by the given NodePath.
Object:get_instance_id () Returns the Object's unique instance ID.
Object:get_meta_list () Returns the Object's metadata as a PoolStringArray.
Object:get_method_list () Returns the object's methods and their signatures as an Array.
Object:get_property_list () Returns the Object's property list as an Array of Dictionaries.
Object:get_script () Returns the object's Script instance, or nil if none is assigned.
Object:get_signal_connection_list (signal) Returns an Array of connections for the given signal.
Object:get_signal_list () Returns the list of signals as an Array of dictionaries.
Object:has_meta (name) Returns true if a metadata entry is found with the given name.
Object:has_method (name) Returns true if the Object contains a method with the given name.
Object:has_signal (signal) Returns true if the given signal exists.
Object:has_user_signal (signal) Returns true if the given user-defined signal exists.
Object:is_blocking_signals () Returns true if signal emission blocking is enabled.
Object:is_class (class) Returns true if the Object inherits from the given class.
Object:is_connected (signal, target, method) Returns true if a connection exists for a given signal, target, and method.
Object:is_instance_valid () Check if an Object is a valid instance.
Object:is_queued_for_deletion () Returns true if the Node.queue_free method was called for the Object.
Object:notification (what[, reversed=false]) Send a given notification to the object, which will also trigger a call to the _notification method of all classes that the Object inherits from.
Object:pcall (method, ...) Make a protected call to method with the passed name and arguments.
Object:property_list_changed_notify () Notify the editor that the property list has changed, so that editor plugins can take the new values into account.
Object:remove_meta (name) Removes a given entry from the object's metadata.
Object:set (property, value) Assigns a new value to the given property.
Object:set_block_signals (enable) If set to true, signal emission is blocked.
Object:set_deferred (property, value) Assigns a new value to the given property, after the current frame's physics step.
Object:set_indexed (property, value) Assigns a new value to the property identified by the NodePath.
Object:set_message_translation (enable) Defines whether the Object can translate strings (with calls to tr).
Object:set_meta (name, value) Adds, changes or removes a given entry in the Object's metadata.
Object:set_script (script) Assigns a script to the Object.
Object:to_string () Returns a String representing the Object.
Object:tr (message) Translates a message using translation catalogs configured in the Project Settings.

Metamethods

Object:__concat (a, b) Concatenates values.
Object:__index (key) Returns a method binding if key is a method name, otherwise returns self:get(key).
Object:__newindex (property, value) Alias for set, so that the idiom object.property = value sets a property.
Object:__tostring () Returns a Lua string representation of this Object, as per to_string.


Fields

Object.null
((godot_object *) NULL): The null Object, useful as default values of properties.

Methods

Object:add_user_signal (signal[, arguments])
Adds a user-defined signal.

Parameters:

  • signal Signal name
  • arguments Array of Dictionaries, each containing name: String and type: int (see Variant.Type) entries. (optional)
Object:call (method, ...)
Calls the method on the Object and returns the result.

Parameters:

  • method Method name
  • ...

Returns:

    Method result

See also:

Object:call_deferred (method, ...)
Calls the method on the Object during idle time.

Parameters:

  • method Method name
  • ...
Object:can_translate_messages ()
Returns true if the Object can translate strings.

Returns:

    bool

See also:

Object:connect (signal, target, method[, binds[, flags]])
Connects a signal to a method on a target Object. Parameters passed in binds will be passed to the method after any parameter used in the call to emit_signal.

Parameters:

  • signal Signal name
  • target Target Object
  • method Method name
  • binds Array (optional)
  • flags (optional)

Returns:

    Error

See also:

Object:disconnect (signal, target, method)
Disconnects a signal from a method on the given target.

Parameters:

  • signal Signal name
  • target Target Object
  • method Method name

See also:

Object:emit_signal (signal, ...)
Emits the given signal. The signal must exist.

Parameters:

  • signal Signal name
  • ...
Object:free ()
Deletes the object from memory immediately. For Nodes, you may want to use Node.queue_free to queue the node for safe deletion at the end of the current frame.
Object:get (property)
Returns the value of the given property.

Parameters:

  • property Property name

Returns:

    Property value, if it exists

Or

    nil If property does not exist
Object:get_class ()
Returns the Object's class name.

Returns:

    String
Object:get_class_wrapper ()
Get the OOP.ClassWrapper associated with this Object's class. OOP.ClassWrapper instances are cached internally.

Returns:

    ClassWrapper
Object:get_incoming_connections ()

Returns an Array of Dictionaries with information about signals that are connected to the Object. Each Dictionary contains three String entries:

  • source is a reference to the signal emitter.
  • signal_name is the name of the connected signal.
  • method_name is the name of the method to which the signal is connected.

Returns:

    Array
Object:get_indexed (property)
Gets the Object's property indexed by the given NodePath. The node path should be relative to the current object and can use the colon character (:) to access nested properties.

Parameters:

  • property

Returns:

    Property value
Object:get_instance_id ()
Returns the Object's unique instance ID.

Returns:

    int
Object:get_meta_list ()
Returns the Object's metadata as a PoolStringArray.

Returns:

    PoolStringArray
Object:get_method_list ()
Returns the object's methods and their signatures as an Array.

Returns:

    Array
Object:get_property_list ()
Returns the Object's property list as an Array of Dictionaries. Each property's Dictionary contain at least name: String and type: int (see Variant.Type) entries. Optionally, it can also include hint: int (see PropertyHint), hint_string: String, and usage: int (see PropertyUsageFlags).

Returns:

    Array
Object:get_script ()
Returns the object's Script instance, or nil if none is assigned.

Returns:

    Object or nil
Object:get_signal_connection_list (signal)
Returns an Array of connections for the given signal.

Parameters:

  • signal Signal name

Returns:

    Array
Object:get_signal_list ()
Returns the list of signals as an Array of dictionaries.

Returns:

    Array
Object:has_meta (name)
Returns true if a metadata entry is found with the given name.

Parameters:

  • name

Returns:

    bool
Object:has_method (name)
Returns true if the Object contains a method with the given name.

Parameters:

  • name

Returns:

    bool
Object:has_signal (signal)
Returns true if the given signal exists.

Parameters:

  • signal

Returns:

    bool
Object:has_user_signal (signal)
Returns true if the given user-defined signal exists. Only signals added using add_user_signal are taken into account.

Parameters:

  • signal

Returns:

    bool
Object:is_blocking_signals ()
Returns true if signal emission blocking is enabled.

Returns:

    bool

See also:

Object:is_class (class)
Returns true if the Object inherits from the given class.

Parameters:

  • class

Returns:

    bool
Object:is_connected (signal, target, method)
Returns true if a connection exists for a given signal, target, and method.

Parameters:

  • signal Signal name
  • target Target Object
  • method Method name

Returns:

    bool

See also:

Object:is_instance_valid ()
Check if an Object is a valid instance. Can also be called as Object.is_instance_valid(some_object_or_nil)

Returns:

    bool
Object:is_queued_for_deletion ()
Returns true if the Node.queue_free method was called for the Object.

Returns:

    bool
Object:notification (what[, reversed=false])
Send a given notification to the object, which will also trigger a call to the _notification method of all classes that the Object inherits from.

Parameters:

  • what
  • reversed (default false)
Object:pcall (method, ...)
Make a protected call to method with the passed name and arguments.

Parameters:

  • method Method name
  • ...

Returns:

  1. bool true if method was called successfully
  2. Method call result

Or

  1. bool false on errors
  2. Error message

See also:

Object:property_list_changed_notify ()
Notify the editor that the property list has changed, so that editor plugins can take the new values into account. Does nothing on export builds.
Object:remove_meta (name)
Removes a given entry from the object's metadata.

Parameters:

  • name

See also:

Object:set (property, value)
Assigns a new value to the given property. If the property does not exist, nothing will happen.

Parameters:

  • property
  • value
Object:set_block_signals (enable)
If set to true, signal emission is blocked.

Parameters:

  • enable
Object:set_deferred (property, value)
Assigns a new value to the given property, after the current frame's physics step. This is equivalent to calling set via call_deferred.

Parameters:

  • property
  • value
Object:set_indexed (property, value)
Assigns a new value to the property identified by the NodePath. The node path should be relative to the current object and can use the colon character (:) to access nested properties.

Parameters:

  • property
  • value
Object:set_message_translation (enable)
Defines whether the Object can translate strings (with calls to tr). Enabled by default.

Parameters:

  • enable

See also:

Object:set_meta (name, value)
Adds, changes or removes a given entry in the Object's metadata. If value is set to nil, metadata for name is removed.

Parameters:

  • name
  • value
Object:set_script (script)
Assigns a script to the Object. If the Object already had a script, the previous script instance will be freed and its variables and state will be lost.

Parameters:

Object:to_string ()
Returns a String representing the Object. Override the method _to_string to customize the String representation. If not overridden, defaults to "[ClassName:RID]".

Returns:

    String
Object:tr (message)
Translates a message using translation catalogs configured in the Project Settings. Only works if message translation is enabled (which it is by default), otherwise it returns the message unchanged.

Parameters:

  • message

Returns:

    String

See also:

Metamethods

Object:__concat (a, b)
Concatenates values.

Parameters:

  • a First value, stringified with GD.str
  • b First value, stringified with GD.str

Returns:

    String
Object:__index (key)
Returns a method binding if key is a method name, otherwise returns self:get(key).

Parameters:

Returns:

    OOP.MethodBindByName If self:has_method(key)

Or

    Result from self:get(key)

See also:

Object:__newindex (property, value)
Alias for set, so that the idiom object.property = value sets a property.

Parameters:

  • property
  • value

See also:

Object:__tostring ()
Returns a Lua string representation of this Object, as per to_string.

Returns:

    string
generated by LDoc 1.4.6 Last updated 2023-01-04 08:52:34