Class NodePath
NodePath metatype, wrapper for godot_node_path
.
Construct using the idiom NodePath(path)
, which calls __new.
Methods
NodePath:as_string () | Gets a String that represents this NodePath. |
NodePath:get_as_property_path () | Returns a node path with a colon character (: ) prepended, transforming it to a pure property path with no node name (defaults to resolving from the current node). |
NodePath:get_concatenated_subnames () | Returns all subnames concatenated with a colon character (: ) as separator, i.e. |
NodePath:get_name (idx) | Gets the node name indicated by idx . |
NodePath:get_name_count () | Gets the number of node names which make up the path. |
NodePath:get_subname (idx) | Gets the resource or property name indicated by idx . |
NodePath:get_subname_count () | Gets the number of resource or property names ("subnames") in the path. |
NodePath:is_absolute () | Returns true if the node path is absolute (as opposed to relative), which means that it starts with a slash character (/ ). |
NodePath:is_empty () | Returns true if the node path is empty. |
Metamethods
NodePath:__concat (a, b) | Concatenates values. |
NodePath:__eq (a, b) | Equality comparison (a == b ). |
NodePath:__new ([path]) | NodePath constructor, called by the idiom NodePath(path) . |
NodePath:__tostring () | Returns a Lua string representation of this NodePath. |
Methods
- NodePath:as_string ()
-
Gets a String that represents this NodePath.
Returns:
- NodePath:get_as_property_path ()
-
Returns a node path with a colon character (
:
) prepended, transforming it to a pure property path with no node name (defaults to resolving from the current node).Returns:
- NodePath:get_concatenated_subnames ()
-
Returns all subnames concatenated with a colon character (
:
) as separator, i.e. the right side of the first colon in a node path.Returns:
- NodePath:get_name (idx)
-
Gets the node name indicated by
idx
.Parameters:
- idx int
Returns:
- NodePath:get_name_count ()
-
Gets the number of node names which make up the path.
Subnames (see get_subname_count) are not included.
Returns:
-
int
- NodePath:get_subname (idx)
-
Gets the resource or property name indicated by
idx
.Parameters:
- idx int
Returns:
- NodePath:get_subname_count ()
-
Gets the number of resource or property names ("subnames") in the path.
Each subname is listed after a colon character (
:
) in the node path.Returns:
-
int
- NodePath:is_absolute ()
-
Returns
true
if the node path is absolute (as opposed to relative), which means that it starts with a slash character (/
).Returns:
-
bool
- NodePath:is_empty ()
-
Returns
true
if the node path is empty.Returns:
-
bool
Metamethods
- NodePath:__concat (a, b)
-
Concatenates values.
Parameters:
Returns:
- NodePath:__eq (a, b)
-
Equality comparison (
a == b
). If eithera
orb
are not of type NodePath, String or Lua string, always returnfalse
.Parameters:
- a
- b
Returns:
-
bool
- NodePath:__new ([path])
-
NodePath constructor, called by the idiom
NodePath(path)
.NodePath()
: empty NodePathNodePath(any path)
: created withpath
stringified with GD.strNodePath(NodePath other)
: copy fromother
Parameters:
- path (optional)
Returns:
- NodePath:__tostring ()
-
Returns a Lua string representation of this NodePath.
Returns:
See also: