gd

package
v0.0.0-...-9578a16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Code generated by the generate package DO NOT EDIT

Code generated by the generate package DO NOT EDIT

Index

Constants

This section is empty.

Variables

View Source
var ObjectAs = func(name string, ptr Pointer) any {
	var obj Object
	obj.SetPointer(ptr)
	return obj
}

Functions

func As

func As[T IsClass](godot Lifetime, class IsClass) (T, bool)

As attempts to cast the given class to T, returning true if the cast was successful.

func FrameGet

func FrameGet[T any](frame callFrame) T

func FrameSet

func FrameSet[T any](index int, frame callFrame, value T)

func LetVariantAsPointerType

func LetVariantAsPointerType[T mmm.PointerWithFree[API, T, Size], Size mmm.PointerSize](ctx Lifetime, variant Variant, vtype VariantType) T

func PointerWithOwnershipTransferredToGodot

func PointerWithOwnershipTransferredToGodot(godot Lifetime, ptr Pointer) uintptr

func UnsafeGet

func UnsafeGet[T any](frame UnsafeArgs, index int) T

func UnsafeSet

func UnsafeSet[T any](frame UnsafeBack, value T)

func VirtualByName

func VirtualByName(class IsClass, name string) reflect.Value

Types

type AABB

type AABB = xy.AABB

type API

type API struct {
	api.Specification

	GetGodotVersion     func() Version
	GetNativeStructSize func(StringName) uintptr

	Memory struct {
		Allocate   func(uintptr) unsafe.Pointer
		Reallocate func(unsafe.Pointer, uintptr) unsafe.Pointer
		Free       func(unsafe.Pointer)
	}

	PrintError              func(code, function, file string, line int32, notifyEditor bool)
	PrintErrorMessage       func(code, message, function, file string, line int32, notifyEditor bool)
	PrintWarning            func(code, function, file string, line int32, notifyEditor bool)
	PrintWarningMessage     func(code, message, function, file string, line int32, notifyEditor bool)
	PrintScriptError        func(code, function, file string, line int32, notifyEditor bool)
	PrintScriptErrorMessage func(code, message, function, file string, line int32, notifyEditor bool)

	Variants struct {
		NewCopy                   func(ctx Lifetime, src Variant) Variant
		NewNil                    func(ctx Lifetime) Variant
		Destroy                   func(self Variant)
		Call                      func(ctx Lifetime, self Variant, method StringName, args ...Variant) (Variant, error)
		CallStatic                func(ctx Lifetime, vtype VariantType, method StringName, args ...Variant) (Variant, error)
		Evaluate                  func(ctx Lifetime, operator Operator, a, b Variant) (ret Variant, ok bool)
		Set                       func(self, key, val Variant) bool
		SetNamed                  func(self Variant, key StringName, val Variant) bool
		SetKeyed                  func(self, key, val Variant) bool
		SetIndexed                func(self Variant, index Int, val Variant) (ok, oob bool)
		Get                       func(ctx Lifetime, self, key Variant) (Variant, bool)
		GetNamed                  func(ctx Lifetime, self Variant, key StringName) (Variant, bool)
		GetKeyed                  func(ctx Lifetime, self, key Variant) (Variant, bool)
		GetIndexed                func(ctx Lifetime, self Variant, index Int) (val Variant, ok, oob bool)
		IteratorInitialize        func(ctx Lifetime, self Variant) (Variant, bool)
		IteratorNext              func(self Variant, iterator Variant) bool
		IteratorGet               func(ctx Lifetime, self Variant, iterator Variant) (Variant, bool)
		Hash                      func(self Variant) Int
		RecursiveHash             func(self Variant, count Int) Int
		HashCompare               func(self, variant Variant) bool
		Booleanize                func(self Variant) bool
		Duplicate                 func(ctx Lifetime, self Variant, deep bool) Variant
		Stringify                 func(ctx Lifetime, self Variant) String
		GetType                   func(self Variant) VariantType
		HasMethod                 func(self Variant, method StringName) bool
		HasMember                 func(self Variant, member StringName) bool
		HasKey                    func(self Variant, key Variant) (hasKey, valid bool)
		GetTypeName               func(ctx Lifetime, self VariantType) String
		CanConvert                func(self Variant, to VariantType) bool
		CanConvertStrict          func(self Variant, to VariantType) bool
		FromTypeConstructor       func(VariantType) func(ret callframe.Ptr[[3]uintptr], arg uintptr)
		ToTypeConstructor         func(VariantType) func(ret uintptr, arg callframe.Ptr[[3]uintptr])
		PointerOperatorEvaluator  func(op Operator, a, b VariantType) func(a, b, ret uintptr)
		GetPointerBuiltinMethod   func(VariantType, StringName, Int) func(base uintptr, args callframe.Args, ret uintptr, c int32)
		GetPointerConstructor     func(vtype VariantType, index int32) func(base uintptr, args callframe.Args)
		GetPointerDestructor      func(VariantType) func(base uintptr)
		Construct                 func(ctx Lifetime, t VariantType, args ...Variant) (Variant, error)
		GetPointerSetter          func(VariantType, StringName) func(base, arg uintptr)
		GetPointerGetter          func(VariantType, StringName) func(base, ret uintptr)
		GetPointerIndexedSetter   func(VariantType) func(base uintptr, index Int, arg uintptr)
		GetPointerIndexedGetter   func(VariantType) func(base uintptr, index Int, ret uintptr)
		GetPointerKeyedSetter     func(VariantType) func(base uintptr, key uintptr, arg uintptr)
		GetPointerKeyedGetter     func(VariantType) func(base uintptr, key uintptr, ret uintptr)
		GetPointerKeyedChecker    func(VariantType) func(base uintptr, key uintptr) uint32
		GetConstantValue          func(ctx Lifetime, t VariantType, name StringName) Variant
		GetPointerUtilityFunction func(name StringName, hash Int) func(ret uintptr, args callframe.Args, c int32)
	}
	Strings struct {
		New        func(Lifetime, string) String
		Get        func(String) string
		SetIndex   func(String, Int, rune)
		Index      func(String, Int) rune
		Append     func(Lifetime, String, String) String
		AppendRune func(String, rune)
		Resize     func(String, Int)

		UnsafePointer func(String) unsafe.Pointer
	}
	StringNames struct {
		New func(Lifetime, string) StringName
	}
	XMLParser struct {
		OpenBuffer func(Object, []byte) error
	}
	FileAccess struct {
		StoreBuffer func(Object, []byte)
		GetBuffer   func(Object, []byte) int
	}
	PackedByteArray    PackedFunctionsFor[PackedByteArray, byte]
	PackedColorArray   PackedFunctionsFor[PackedColorArray, Color]
	PackedFloat32Array PackedFunctionsFor[PackedFloat32Array, float32]
	PackedFloat64Array PackedFunctionsFor[PackedFloat64Array, float64]
	PackedInt32Array   PackedFunctionsFor[PackedInt32Array, int32]
	PackedInt64Array   PackedFunctionsFor[PackedInt64Array, int64]
	PackedStringArray  struct {
		Index       func(Lifetime, PackedStringArray, Int) String
		SetIndex    func(PackedStringArray, Int, String)
		CopyAsSlice func(Lifetime, PackedStringArray) []String
	}
	PackedVector2Array PackedFunctionsFor[PackedVector2Array, Vector2]
	PackedVector3Array PackedFunctionsFor[PackedVector3Array, Vector3]
	PackedVector4Array PackedFunctionsFor[PackedVector4Array, Vector4]
	Array              struct {
		Index    func(Lifetime, Array, Int) Variant
		Set      func(self, from Array)
		SetIndex func(Array, Int, Variant)
		SetTyped func(self Array, t VariantType, className StringName, script Object)
	}
	Dictionary struct {
		Index    func(ctx Lifetime, dict Dictionary, key Variant) Variant
		SetIndex func(dict Dictionary, key, val Variant)
	}
	Object struct {
		MethodBindCall        func(ctx Lifetime, method MethodBind, obj Object, arg ...Variant) (Variant, error)
		MethodBindPointerCall func(method MethodBind, obj Object, arg callframe.Args, ret uintptr)
		Destroy               func(Object)
		GetSingleton          func(ctx Lifetime, name StringName) Object
		GetInstanceBinding    func(Object, ExtensionToken, InstanceBindingType) any
		SetInstanceBinding    func(Object, ExtensionToken, any, InstanceBindingType)
		FreeInstanceBinding   func(Object, ExtensionToken)
		SetInstance           func(Object, StringName, ObjectInterface)
		GetClassName          func(Lifetime, Object, ExtensionToken) String
		CastTo                func(Object, ClassTag) Object
		GetInstanceID         func(Object) ObjectID
		GetInstanceFromID     func(Lifetime, ObjectID) Object
	}
	RefCounted struct {
		GetObject func(Lifetime, Object) Object
		SetObject func(Object, Object)
	}
	Callables struct {
		Create func(ctx Lifetime, fn func(...Variant) (Variant, error)) Callable
		Get    func(Callable) (func(...Variant) (Variant, error), bool)
	}
	ClassDB struct {
		ConstructObject func(Lifetime, StringName) Object
		GetClassTag     func(StringName) ClassTag
		GetMethodBind   func(class, method StringName, hash Int) MethodBind

		RegisterClass                 func(library ExtensionToken, name, extends StringName, info ClassInterface)
		RegisterClassMethod           func(ctx Lifetime, library ExtensionToken, class StringName, info Method)
		RegisterClassIntegerConstant  func(library ExtensionToken, class, enum, name StringName, value int64, bitfield bool)
		RegisterClassProperty         func(library ExtensionToken, class StringName, info PropertyInfo, getter, setter StringName)
		RegisterClassPropertyIndexed  func(library ExtensionToken, class StringName, info PropertyInfo, getter, setter StringName, index int64)
		RegisterClassPropertyGroup    func(library ExtensionToken, class StringName, group, prefix String)
		RegisterClassPropertySubGroup func(library ExtensionToken, class StringName, subGroup, prefix String)
		RegisterClassSignal           func(library ExtensionToken, class, signal StringName, args []PropertyInfo)
		UnregisterClass               func(library ExtensionToken, class StringName)
	}
	EditorPlugins struct {
		Add    func(plugin StringName)
		Remove func(plugin StringName)
	}

	GetLibraryPath func(Lifetime, ExtensionToken) String

	ExtensionToken

	// extensions instances are mapped here.
	Instances  map[uintptr]ExtensionClass
	Singletons singletons
	// contains filtered or unexported fields
}

API specification for Godot's GDExtension.

func (*API) Init

func (Godot *API) Init(static Lifetime, level GDExtensionInitializationLevel)

Link needs to be called once for the API to load in all of the dynamic function pointers. Typically, the link layer will take care of this (and you won't need to call it yourself).

func (API) NewFrame

func (Godot API) NewFrame() (frame callFrame)

func (*API) StringFromStringName

func (Godot *API) StringFromStringName(ctx Lifetime, s StringName) String

func (*API) StringNameFromString

func (Godot *API) StringNameFromString(ctx Lifetime, s String) StringName

type Array

type Array mmm.Pointer[API, Array, uintptr]

func (Array) All

func (self Array) All(method Callable) bool

Calls the given Callable on each element in the array and returns [code]true[/code] if the Callable returns [code]true[/code] for [i]all[/i] elements in the array. If the Callable returns [code]false[/code] for one array element or more, this method returns [code]false[/code]. The [param method] should take one Variant parameter (the current array element) and return a [bool]. [codeblocks] [gdscript] func greater_than_5(number):

return number > 5

func _ready():

print([6, 10, 6].all(greater_than_5)) # Prints true (3/3 elements evaluate to true).
print([4, 10, 4].all(greater_than_5)) # Prints false (1/3 elements evaluate to true).
print([4, 4, 4].all(greater_than_5))  # Prints false (0/3 elements evaluate to true).
print([].all(greater_than_5))         # Prints true (0/0 elements evaluate to true).

# Same as the first line above, but using a lambda function.
print([6, 10, 6].all(func(element): return element > 5)) # Prints true

[/gdscript] [csharp] private static bool GreaterThan5(int number)

{
    return number > 5;
}

public override void _Ready()

{
    // Prints true (3/3 elements evaluate to true).
    GD.Print(new Godot.Collections.Array>int< { 6, 10, 6 }.All(GreaterThan5));
    // Prints false (1/3 elements evaluate to true).
    GD.Print(new Godot.Collections.Array>int< { 4, 10, 4 }.All(GreaterThan5));
    // Prints false (0/3 elements evaluate to true).
    GD.Print(new Godot.Collections.Array>int< { 4, 4, 4 }.All(GreaterThan5));
    // Prints true (0/0 elements evaluate to true).
    GD.Print(new Godot.Collections.Array>int< { }.All(GreaterThan5));

    // Same as the first line above, but using a lambda function.
    GD.Print(new Godot.Collections.Array>int< { 6, 10, 6 }.All(element => element > 5)); // Prints true
}

[/csharp] [/codeblocks] See also [method any], [method filter], [method map] and [method reduce]. [b]Note:[/b] Unlike relying on the size of an array returned by [method filter], this method will return as early as possible to improve performance (especially with large arrays). [b]Note:[/b] For an empty array, this method [url=https://en.wikipedia.org/wiki/Vacuous_truth]always[/url] returns [code]true[/code].

func (Array) Any

func (self Array) Any(method Callable) bool

Calls the given Callable on each element in the array and returns [code]true[/code] if the Callable returns [code]true[/code] for [i]one or more[/i] elements in the array. If the Callable returns [code]false[/code] for all elements in the array, this method returns [code]false[/code]. The [param method] should take one Variant parameter (the current array element) and return a [bool]. [codeblock] func greater_than_5(number):

return number > 5

func _ready():

print([6, 10, 6].any(greater_than_5)) # Prints true (3 elements evaluate to true).
print([4, 10, 4].any(greater_than_5)) # Prints true (1 elements evaluate to true).
print([4, 4, 4].any(greater_than_5))  # Prints false (0 elements evaluate to true).
print([].any(greater_than_5))         # Prints false (0 elements evaluate to true).

# Same as the first line above, but using a lambda function.
print([6, 10, 6].any(func(number): return number > 5)) # Prints true

[/codeblock] See also [method all], [method filter], [method map] and [method reduce]. [b]Note:[/b] Unlike relying on the size of an array returned by [method filter], this method will return as early as possible to improve performance (especially with large arrays). [b]Note:[/b] For an empty array, this method always returns [code]false[/code].

func (Array) Append

func (self Array) Append(value Variant)

Appends [param value] at the end of the array (alias of [method push_back]).

func (Array) AppendArray

func (self Array) AppendArray(array Array)

Appends another [param array] at the end of this array. [codeblock] var numbers = [1, 2, 3] var extra = [4, 5, 6] numbers.append_array(extra) print(nums) # Prints [1, 2, 3, 4, 5, 6] [/codeblock]

func (Array) Assign

func (self Array) Assign(array Array)

Assigns elements of another [param array] into the array. Resizes the array to match [param array]. Performs type conversions if the array is typed.

func (Array) Back

func (self Array) Back(ctx Lifetime) Variant

Returns the last element of the array. If the array is empty, fails and returns [code]null[/code]. See also [method front]. [b]Note:[/b] Unlike with the [code][][/code] operator ([code]array[-1][/code]), an error is generated without stopping project execution.

func (Array) Bsearch

func (self Array) Bsearch(value Variant, before bool) Int

Returns the index of [param value] in the sorted array. If it cannot be found, returns where [param value] should be inserted to keep the array sorted. The algorithm used is [url=https://en.wikipedia.org/wiki/Binary_search_algorithm]binary search[/url]. If [param before] is [code]true[/code] (as by default), the returned index comes before all existing elements equal to [param value] in the array. [codeblock] var numbers = [2, 4, 8, 10] var idx = numbers.bsearch(7)

numbers.insert(idx, 7) print(numbers) # Prints [2, 4, 7, 8, 10]

var fruits = ["Apple", "Lemon", "Lemon", "Orange"] print(fruits.bsearch("Lemon", true)) # Prints 1, points at the first "Lemon". print(fruits.bsearch("Lemon", false)) # Prints 3, points at "Orange". [/codeblock] [b]Note:[/b] Calling [method bsearch] on an [i]unsorted[/i] array will result in unexpected behavior. Use [method sort] before calling this method.

func (Array) BsearchCustom

func (self Array) BsearchCustom(value Variant, fn Callable, before bool) Int

Returns the index of [param value] in the sorted array. If it cannot be found, returns where [param value] should be inserted to keep the array sorted (using [param func] for the comparisons). The algorithm used is [url=https://en.wikipedia.org/wiki/Binary_search_algorithm]binary search[/url]. Similar to [method sort_custom], [param func] is called as many times as necessary, receiving one array element and [param value] as arguments. The function should return [code]true[/code] if the array element should be [i]behind[/i] [param value], otherwise it should return [code]false[/code]. If [param before] is [code]true[/code] (as by default), the returned index comes before all existing elements equal to [param value] in the array. [codeblock] func sort_by_amount(a, b):

if a[1] < b[1]:
    return true
return false

func _ready():

var my_items = [["Tomato", 2], ["Kiwi", 5], ["Rice", 9]]

var apple = ["Apple", 5]
# "Apple" is inserted before "Kiwi".
my_items.insert(my_items.bsearch_custom(apple, sort_by_amount, true), apple)

var banana = ["Banana", 5]
# "Banana" is inserted after "Kiwi".
my_items.insert(my_items.bsearch_custom(banana, sort_by_amount, false), banana)

# Prints [["Tomato", 2], ["Apple", 5], ["Kiwi", 5], ["Banana", 5], ["Rice", 9]]
print(my_items)

[/codeblock] [b]Note:[/b] Calling [method bsearch_custom] on an [i]unsorted[/i] array will result in unexpected behavior. Use [method sort_custom] with [param func] before calling this method.

func (Array) Clear

func (self Array) Clear()

Removes all elements from the array. This is equivalent to using [method resize] with a size of [code]0[/code].

func (Array) Count

func (self Array) Count(value Variant) Int

Returns the number of times an element is in the array.

func (Array) Duplicate

func (self Array) Duplicate(ctx Lifetime, deep bool) Array

Returns a new copy of the array. By default, a [b]shallow[/b] copy is returned: all nested Array and Dictionary elements are shared with the original array. Modifying them in one array will also affect them in the other.[br]If [param deep] is [code]true[/code], a [b]deep[/b] copy is returned: all nested arrays and dictionaries are also duplicated (recursively).

func (Array) Erase

func (self Array) Erase(value Variant)

Finds and removes the first occurrence of [param value] from the array. If [param value] does not exist in the array, nothing happens. To remove an element by index, use [method remove_at] instead. [b]Note:[/b] This method shifts every element's index after the removed [param value] back, which may have a noticeable performance cost, especially on larger arrays. [b]Note:[/b] Erasing elements while iterating over arrays is [b]not[/b] supported and will result in unpredictable behavior.

func (Array) Fill

func (self Array) Fill(value Variant)

Assigns the given [param value] to all elements in the array. This method can often be combined with [method resize] to create an array with a given size and initialized elements: [codeblocks] [gdscript] var array = [] array.resize(5) array.fill(2) print(array) # Prints [2, 2, 2, 2, 2] [/gdscript] [csharp] var array = new Godot.Collections.Array(); array.Resize(5); array.Fill(2); GD.Print(array); // Prints [2, 2, 2, 2, 2] [/csharp] [/codeblocks] [b]Note:[/b] If [param value] is a Variant passed by reference (Object-derived, Array, Dictionary, etc.), the array will be filled with references to the same [param value], which are not duplicates.

func (Array) Filter

func (self Array) Filter(ctx Lifetime, method Callable) Array

Calls the given Callable on each element in the array and returns a new, filtered Array. The [param method] receives one of the array elements as an argument, and should return [code]true[/code] to add the element to the filtered array, or [code]false[/code] to exclude it. [codeblock] func is_even(number):

return number % 2 == 0

func _ready():

print([1, 4, 5, 8].filter(is_even)) # Prints [4, 8]

# Same as above, but using a lambda function.
print([1, 4, 5, 8].filter(func(number): return number % 2 == 0))

[/codeblock] See also [method any], [method all], [method map] and [method reduce].

func (Array) Find

func (self Array) Find(what Variant, from Int) Int

Returns the index of the [b]first[/b] occurrence of [param what] in this array, or [code]-1[/code] if there are none. The search's start can be specified with [param from], continuing to the end of the array. [b]Note:[/b] If you just want to know whether the array contains [param what], use [method has] ([code]Contains[/code] in C#). In GDScript, you may also use the [code]in[/code] operator. [b]Note:[/b] For performance reasons, the search is affected by [param what]'s [enum Variant.Type]. For example, [code]7[/code] ([int]) and [code]7.0[/code] ([float]) are not considered equal for this method.

func (Array) Free

func (a Array) Free()

func (Array) Front

func (self Array) Front(ctx Lifetime) Variant

Returns the first element of the array. If the array is empty, fails and returns [code]null[/code]. See also [method back]. [b]Note:[/b] Unlike with the [code][][/code] operator ([code]array[0][/code]), an error is generated without stopping project execution.

func (Array) GetTypedBuiltin

func (self Array) GetTypedBuiltin() Int

Returns the built-in Variant type of the typed array as a [enum Variant.Type] constant. If the array is not typed, returns [constant TYPE_NIL]. See also [method is_typed].

func (Array) GetTypedClassName

func (self Array) GetTypedClassName(ctx Lifetime) StringName

Returns the [b]built-in[/b] class name of the typed array, if the built-in Variant type [constant TYPE_OBJECT]. Otherwise, returns an empty StringName. See also [method is_typed] and [method Object.get_class].

func (Array) GetTypedScript

func (self Array) GetTypedScript(ctx Lifetime) Variant

Returns the [Script] instance associated with this typed array, or [code]null[/code] if it does not exist. See also [method is_typed].

func (Array) Has

func (self Array) Has(value Variant) bool

Returns [code]true[/code] if the array contains the given [param value]. [codeblocks] [gdscript] print(["inside", 7].has("inside")) # Prints true print(["inside", 7].has("outside")) # Prints false print(["inside", 7].has(7)) # Prints true print(["inside", 7].has("7")) # Prints false [/gdscript] [csharp] var arr = new Godot.Collections.Array { "inside", 7 }; // By C# convention, this method is renamed to `Contains`. GD.Print(arr.Contains("inside")); // Prints true GD.Print(arr.Contains("outside")); // Prints false GD.Print(arr.Contains(7)); // Prints true GD.Print(arr.Contains("7")); // Prints false [/csharp] [/codeblocks] In GDScript, this is equivalent to the [code]in[/code] operator: [codeblock] if 4 in [2, 4, 6, 8]:

print("4 is here!") # Will be printed.

[/codeblock] [b]Note:[/b] For performance reasons, the search is affected by the [param value]'s [enum Variant.Type]. For example, [code]7[/code] ([int]) and [code]7.0[/code] ([float]) are not considered equal for this method.

func (Array) Hash

func (self Array) Hash() Int

Returns a hashed 32-bit integer value representing the array and its contents. [b]Note:[/b] Arrays with equal hash values are [i]not[/i] guaranteed to be the same, as a result of hash collisions. On the countrary, arrays with different hash values are guaranteed to be different.

func (Array) Index

func (a Array) Index(ctx Lifetime, index Int) Variant

func (Array) Insert

func (self Array) Insert(position Int, value Variant) Int

Inserts a new element ([param value]) at a given index ([param position]) in the array. [param position] should be between [code]0[/code] and the array's [method size]. Returns [constant OK] on success, or one of the other [enum Error] constants if this method fails. [b]Note:[/b] Every element's index after [param position] needs to be shifted forward, which may have a noticeable performance cost, especially on larger arrays.

func (Array) IsEmpty

func (self Array) IsEmpty() bool

Returns [code]true[/code] if the array is empty ([code][][/code]). See also [method size].

func (Array) IsReadOnly

func (self Array) IsReadOnly() bool

Returns [code]true[/code] if the array is read-only. See [method make_read_only]. In GDScript, arrays are automatically read-only if declared with the [code]const[/code] keyword.

func (Array) IsSameTyped

func (self Array) IsSameTyped(array Array) bool

Returns [code]true[/code] if this array is typed the same as the given [param array]. See also [method is_typed].

func (Array) IsTyped

func (self Array) IsTyped() bool

Returns [code]true[/code] if the array is typed. Typed arrays can only contain elements of a specific type, as defined by the typed array constructor. The methods of a typed array are still expected to return a generic Variant. In GDScript, it is possible to define a typed array with static typing: [codeblock] var numbers: Array[float] = [0.2, 4.2, -2.0] print(numbers.is_typed()) # Prints true [/codeblock]

func (Array) Iter

func (a Array) Iter() iter.Seq2[Int, Variant]

func (Array) MakeReadOnly

func (self Array) MakeReadOnly()

Makes the array read-only. The array's elements cannot be overridden with different values, and their order cannot change. Does not apply to nested elements, such as dictionaries. In GDScript, arrays are automatically read-only if declared with the [code]const[/code] keyword.

func (Array) Map

func (self Array) Map(ctx Lifetime, method Callable) Array

Calls the given Callable for each element in the array and returns a new array filled with values returned by the [param method]. The [param method] should take one Variant parameter (the current array element) and can return any Variant. [codeblock] func double(number):

return number * 2

func _ready():

print([1, 2, 3].map(double)) # Prints [2, 4, 6]

# Same as above, but using a lambda function.
print([1, 2, 3].map(func(element): return element * 2))

[/codeblock] See also [method filter], [method reduce], [method any] and [method all].

func (Array) Max

func (self Array) Max(ctx Lifetime) Variant

Returns the maximum value contained in the array, if all elements can be compared. Otherwise, returns [code]null[/code]. See also [method min]. To find the maximum value using a custom comparator, you can use [method reduce].

func (Array) Min

func (self Array) Min(ctx Lifetime) Variant

Returns the minimum value contained in the array, if all elements can be compared. Otherwise, returns [code]null[/code]. See also [method max].

func (Array) PickRandom

func (self Array) PickRandom(ctx Lifetime) Variant

Returns a random element from the array. Generates an error and returns [code]null[/code] if the array is empty. [codeblocks] [gdscript] # May print 1, 2, 3.25, or "Hi". print([1, 2, 3.25, "Hi"].pick_random()) [/gdscript] [csharp] var array = new Godot.Collections.Array { 1, 2, 3.25f, "Hi" }; GD.Print(array.PickRandom()); // May print 1, 2, 3.25, or "Hi". [/csharp] [/codeblocks] [b]Note:[/b] Like many similar functions in the engine (such as [method @GlobalScope.randi] or [method shuffle]), this method uses a common, global random seed. To get a predictable outcome from this method, see [method @GlobalScope.seed].

func (Array) PopAt

func (self Array) PopAt(ctx Lifetime, position Int) Variant

Removes and returns the element of the array at index [param position]. If negative, [param position] is considered relative to the end of the array. Returns [code]null[/code] if the array is empty. If [param position] is out of bounds, an error message is also generated. [b]Note:[/b] This method shifts every element's index after [param position] back, which may have a noticeable performance cost, especially on larger arrays.

func (Array) PopBack

func (self Array) PopBack(ctx Lifetime) Variant

Removes and returns the last element of the array. Returns [code]null[/code] if the array is empty, without generating an error. See also [method pop_front].

func (Array) PopFront

func (self Array) PopFront(ctx Lifetime) Variant

Removes and returns the first element of the array. Returns [code]null[/code] if the array is empty, without generating an error. See also [method pop_back]. [b]Note:[/b] This method shifts every other element's index back, which may have a noticeable performance cost, especially on larger arrays.

func (Array) PushBack

func (self Array) PushBack(value Variant)

Appends an element at the end of the array. See also [method push_front].

func (Array) PushFront

func (self Array) PushFront(value Variant)

Adds an element at the beginning of the array. See also [method push_back]. [b]Note:[/b] This method shifts every other element's index forward, which may have a noticeable performance cost, especially on larger arrays.

func (Array) Reduce

func (self Array) Reduce(ctx Lifetime, method Callable, accum Variant) Variant

Calls the given Callable for each element in array, accumulates the result in [param accum], then returns it. The [param method] takes two arguments: the current value of [param accum] and the current array element. If [param accum] is [code]null[/code] (as by default), the iteration will start from the second element, with the first one used as initial value of [param accum]. [codeblock] func sum(accum, number):

return accum + number

func _ready():

print([1, 2, 3].reduce(sum, 0))  # Prints 6
print([1, 2, 3].reduce(sum, 10)) # Prints 16

# Same as above, but using a lambda function.
print([1, 2, 3].reduce(func(accum, number): return accum + number, 10))

[/codeblock] If [method max] is not desirable, this method may also be used to implement a custom comparator: [codeblock] func _ready():

var arr = [Vector2(5, 0), Vector2(3, 4), Vector2(1, 2)]

var longest_vec = arr.reduce(func(max, vec): return vec if is_length_greater(vec, max) else max)
print(longest_vec) # Prints Vector2(3, 4).

func is_length_greater(a, b):

return a.length() > b.length()

[/codeblock] See also [method map], [method filter], [method any] and [method all].

func (Array) RemoveAt

func (self Array) RemoveAt(position Int)

Removes the element from the array at the given index ([param position]). If the index is out of bounds, this method fails. If you need to return the removed element, use [method pop_at]. To remove an element by value, use [method erase] instead. [b]Note:[/b] This method shifts every element's index after [param position] back, which may have a noticeable performance cost, especially on larger arrays. [b]Note:[/b] The [param position] cannot be negative. To remove an element relative to the end of the array, use [code]arr.remove_at(arr.size() - (i + 1))[/code]. To remove the last element from the array, use [code]arr.resize(arr.size() - 1)[/code].

func (Array) Resize

func (self Array) Resize(size Int) Int

Sets the array's number of elements to [param size]. If [param size] is smaller than the array's current size, the elements at the end are removed. If [param size] is greater, new default elements (usually [code]null[/code]) are added, depending on the array's type. Returns [constant OK] on success, or one of the other [enum Error] constants if this method fails. [b]Note:[/b] Calling this method once and assigning the new values is faster than calling [method append] for every new element.

func (Array) Reverse

func (self Array) Reverse()

Reverses the order of all elements in the array.

func (Array) Rfind

func (self Array) Rfind(what Variant, from Int) Int

Returns the index of the [b]last[/b] occurrence of [param what] in this array, or [code]-1[/code] if there are none. The search's start can be specified with [param from], continuing to the beginning of the array. This method is the reverse of [method find].

func (Array) SetIndex

func (a Array) SetIndex(index Int, value Variant)

func (Array) Shuffle

func (self Array) Shuffle()

Shuffles all elements of the array in a random order. [b]Note:[/b] Like many similar functions in the engine (such as [method @GlobalScope.randi] or [method pick_random]), this method uses a common, global random seed. To get a predictable outcome from this method, see [method @GlobalScope.seed].

func (Array) Size

func (self Array) Size() Int

Returns the number of elements in the array. Empty arrays ([code][][/code]) always return [code]0[/code]. See also [method is_empty].

func (Array) Slice

func (self Array) Slice(ctx Lifetime, begin Int, end Int, step Int, deep bool) Array

Returns a new Array containing this array's elements, from index [param begin] (inclusive) to [param end] (exclusive), every [param step] elements. If either [param begin] or [param end] are negative, their value is relative to the end of the array. If [param step] is negative, this method iterates through the array in reverse, returning a slice ordered backwards. For this to work, [param begin] must be greater than [param end]. If [param deep] is [code]true[/code], all nested Array and Dictionary elements in the slice are duplicated from the original, recursively. See also [method duplicate]). [codeblock] var letters = ["A", "B", "C", "D", "E", "F"]

print(letters.slice(0, 2)) # Prints ["A", "B"] print(letters.slice(2, -2)) # Prints ["C", "D"] print(letters.slice(-2, 6)) # Prints ["E", "F"]

print(letters.slice(0, 6, 2)) # Prints ["A", "C", "E"] print(letters.slice(4, 1, -1)) # Prints ["E", "D", "C"] [/codeblock]

func (Array) Sort

func (self Array) Sort()

Sorts the array in ascending order. The final order is dependent on the "less than" ([code]<[/code]) comparison between elements. [codeblocks] [gdscript] var numbers = [10, 5, 2.5, 8] numbers.sort() print(numbers) # Prints [2.5, 5, 8, 10] [/gdscript] [csharp] var numbers = new Godot.Collections.Array { 10, 5, 2.5, 8 }; numbers.Sort(); GD.Print(numbers); // Prints [2.5, 5, 8, 10] [/csharp] [/codeblocks] [b]Note:[/b] The sorting algorithm used is not [url=https://en.wikipedia.org/wiki/Sorting_algorithm#Stability]stable[/url]. This means that equivalent elements (such as [code]2[/code] and [code]2.0[/code]) may have their order changed when calling [method sort].

func (Array) SortCustom

func (self Array) SortCustom(fn Callable)

Sorts the array using a custom Callable. [param func] is called as many times as necessary, receiving two array elements as arguments. The function should return [code]true[/code] if the first element should be moved [i]behind[/i] the second one, otherwise it should return [code]false[/code]. [codeblock] func sort_ascending(a, b):

if a[1] < b[1]:
    return true
return false

func _ready():

var my_items = [["Tomato", 5], ["Apple", 9], ["Rice", 4]]
my_items.sort_custom(sort_ascending)
print(my_items) # Prints [["Rice", 4], ["Tomato", 5], ["Apple", 9]]

# Sort descending, using a lambda function.
my_items.sort_custom(func(a, b): return a[0] > b[0])
print(my_items) # Prints [["Apple", 9], ["Tomato", 5], ["Rice", 4]]

[/codeblock] It may also be necessary to use this method to sort strings by natural order, with [method String.naturalnocasecmp_to], as in the following example: [codeblock] var files = ["newfile1", "newfile2", "newfile10", "newfile11"] files.sort_custom(func(a, b): return a.naturalnocasecmp_to(b) < 0) print(files) # Prints ["newfile1", "newfile2", "newfile10", "newfile11"] [/codeblock] [b]Note:[/b] In C#, this method is not supported. [b]Note:[/b] The sorting algorithm used is not [url=https://en.wikipedia.org/wiki/Sorting_algorithm#Stability]stable[/url]. This means that values considered equal may have their order changed when calling this method. [b]Note:[/b] You should not randomize the return value of [param func], as the heapsort algorithm expects a consistent result. Randomizing the return value will result in unexpected behavior.

type ArrayOf

type ArrayOf[T any] interface {
	IsArray
	IsArrayType[T]

	All(method Callable) bool
	Any(method Callable) bool
	Append(value T)
	AppendArray(array ArrayOf[T])
	Assign(array ArrayOf[T])
	Back(ctx Lifetime) T
	Bsearch(value T, before bool) int64
	BsearchCustom(value T, fn Callable, before bool) int64
	Clear()
	Count(value T) int64
	Duplicate(ctx Lifetime, deep bool) ArrayOf[T]
	Erase(value T)
	Fill(value T)
	Filter(ctx Lifetime, method Callable) ArrayOf[T]
	Find(what T, from int64) int64
	Free()
	Front(ctx Lifetime) T
	GetTypedBuiltin() int64
	GetTypedClassName(ctx Lifetime) StringName
	GetTypedScript(ctx Lifetime) Variant
	Has(value T) bool
	Hash() int64
	Index(ctx Lifetime, index int64) T
	Insert(position int64, value T) int64
	IsEmpty() bool
	IsReadOnly() bool
	IsSameTyped(array Array) bool
	IsTyped() bool
	MakeReadOnly()
	Map(ctx Lifetime, method Callable) ArrayOf[T]
	Max(ctx Lifetime) T
	Min(ctx Lifetime) T
	PickRandom(ctx Lifetime) T
	PopAt(ctx Lifetime, position int64) T
	PopBack(ctx Lifetime) T
	PopFront(ctx Lifetime) T
	PushBack(value T)
	PushFront(value T)
	Reduce(ctx Lifetime, method Callable, accum T) T
	RemoveAt(position int64)
	Resize(size int64) int64
	Reverse()
	Rfind(what T, from int64) int64
	SetIndex(index int64, value T)
	Shuffle()
	Size() int64
	Slice(ctx Lifetime, begin int64, end int64, step int64, deep bool) ArrayOf[T]
	Sort()
	SortCustom(fn Callable)

	UnmarshalInto(any) error
	Iter() iter.Seq2[Int, T]
}

type AudioFrame

type AudioFrame struct {
	Left, Right float32
}

type Basis

type Basis = xy.Basis

type Bool

type Bool = bool

type CallError

type CallError struct {
	ErrorType CallErrorType
	Argument  int32
	Expected  int32
}

func (CallError) Error

func (err CallError) Error() string

type CallErrorType

type CallErrorType int32
const (
	OK CallErrorType = iota
	ErrInvalidMethod
	ErrInvalidArgument
	ErrTooManyArguments
	ErrTooFewArguments
	ErrInstanceIsNil
	ErrMethodNotConst
)

type CallFrameArgs

type CallFrameArgs uintptr

type CallFrameBack

type CallFrameBack uintptr

type Callable

type Callable mmm.Pointer[API, Callable, [2]uintptr]

func (Callable) Bind

func (self Callable) Bind(ctx Lifetime, args ...Variant) Callable

Returns a copy of this Callable with one or more arguments bound. When called, the bound arguments are passed [i]after[/i] the arguments supplied by [method call]. See also [method unbind]. [b]Note:[/b] When this method is chained with other similar methods, the order in which the argument list is modified is read from right to left.

func (Callable) Bindv

func (self Callable) Bindv(ctx Lifetime, arguments Array) Callable

Returns a copy of this Callable with one or more arguments bound, reading them from an array. When called, the bound arguments are passed [i]after[/i] the arguments supplied by [method call]. See also [method unbind]. [b]Note:[/b] When this method is chained with other similar methods, the order in which the argument list is modified is read from right to left.

func (Callable) Call

func (self Callable) Call(ctx Lifetime, args ...Variant) Variant

Calls the method represented by this Callable. Arguments can be passed and should match the method's signature.

func (Callable) CallDeferred

func (self Callable) CallDeferred(args ...Variant)

Calls the method represented by this Callable in deferred mode, i.e. at the end of the current frame. Arguments can be passed and should match the method's signature. [codeblocks] [gdscript] func _ready():

grab_focus.call_deferred()

[/gdscript] [csharp] public override void _Ready()

{
    Callable.From(GrabFocus).CallDeferred();
}

[/csharp] [/codeblocks] [b]Note:[/b] Deferred calls are processed at idle time. Idle time happens mainly at the end of process and physics frames. In it, deferred calls will be run until there are none left, which means you can defer calls from other deferred calls and they'll still be run in the current idle time cycle. This means you should not call a method deferred from itself (or from a method called by it), as this causes infinite recursion the same way as if you had called the method directly. See also [method Object.call_deferred].

func (Callable) Callv

func (self Callable) Callv(ctx Lifetime, arguments Array) Variant

Calls the method represented by this Callable. Unlike [method call], this method expects all arguments to be contained inside the [param arguments] Array.

func (Callable) Create

func (self Callable) Create(ctx Lifetime, variant Variant, method StringName) Callable

Creates a new Callable for the method named [param method] in the specified [param variant]. To represent a method of a built-in Variant type, a custom callable is used (see [method is_custom]). If [param variant] is Object, then a standard callable will be created instead. [b]Note:[/b] This method is always necessary for the Dictionary type, as property syntax is used to access its entries. You may also use this method when [param variant]'s type is not known in advance (for polymorphism).

func (Callable) Free

func (c Callable) Free()

func (Callable) GetArgumentCount

func (self Callable) GetArgumentCount() Int

Returns the total number of arguments this Callable should take, including optional arguments. This means that any arguments bound with [method bind] are [i]subtracted[/i] from the result, and any arguments unbound with [method unbind] are [i]added[/i] to the result.

func (Callable) GetBoundArguments

func (self Callable) GetBoundArguments(ctx Lifetime) Array

Return the bound arguments (as long as [method get_bound_arguments_count] is greater than zero), or empty (if [method get_bound_arguments_count] is less than or equal to zero).

func (Callable) GetBoundArgumentsCount

func (self Callable) GetBoundArgumentsCount() Int

Returns the total amount of arguments bound (or unbound) via successive [method bind] or [method unbind] calls. If the amount of arguments unbound is greater than the ones bound, this function returns a value less than zero.

func (Callable) GetMethod

func (self Callable) GetMethod(ctx Lifetime) StringName

Returns the name of the method represented by this Callable. If the callable is a GDScript lambda function, returns the function's name or [code]"<anonymous lambda>"[/code].

func (Callable) GetObject

func (self Callable) GetObject(ctx Lifetime) Object

Returns the object on which this Callable is called.

func (Callable) GetObjectId

func (self Callable) GetObjectId() Int

Returns the ID of this Callable's object (see [method Object.get_instance_id]).

func (Callable) Hash

func (self Callable) Hash() Int

Returns the 32-bit hash value of this Callable's object. [b]Note:[/b] [Callable]s with equal content will always produce identical hash values. However, the reverse is not true. Returning identical hash values does [i]not[/i] imply the callables are equal, because different callables can have identical hash values due to hash collisions. The engine uses a 32-bit hash algorithm for [method hash].

func (Callable) IsCustom

func (self Callable) IsCustom() bool

Returns [code]true[/code] if this Callable is a custom callable. Custom callables are used: - for binding/unbinding arguments (see [method bind] and [method unbind]); - for representing methods of built-in Variant types (see [method create]); - for representing global, lambda, and RPC functions in GDScript; - for other purposes in the core, GDExtension, and C#.

func (Callable) IsNull

func (self Callable) IsNull() bool

Returns [code]true[/code] if this Callable has no target to call the method on.

func (Callable) IsStandard

func (self Callable) IsStandard() bool

Returns [code]true[/code] if this Callable is a standard callable. This method is the opposite of [method is_custom]. Returns [code]false[/code] if this callable is a lambda function.

func (Callable) IsValid

func (self Callable) IsValid() bool

Returns [code]true[/code] if the callable's object exists and has a valid method name assigned, or is a custom callable.

func (Callable) Rpc

func (self Callable) Rpc(args ...Variant)

Perform an RPC (Remote Procedure Call) on all connected peers. This is used for multiplayer and is normally not available, unless the function being called has been marked as [i]RPC[/i] (using [annotation @GDScript.@rpc] or [method Node.rpc_config]). Calling this method on unsupported functions will result in an error. See [method Node.rpc].

func (Callable) RpcId

func (self Callable) RpcId(peer_id Int, args ...Variant)

Perform an RPC (Remote Procedure Call) on a specific peer ID (see multiplayer documentation for reference). This is used for multiplayer and is normally not available unless the function being called has been marked as [i]RPC[/i] (using [annotation @GDScript.@rpc] or [method Node.rpc_config]). Calling this method on unsupported functions will result in an error. See [method Node.rpc_id].

func (Callable) Unbind

func (self Callable) Unbind(ctx Lifetime, argcount Int) Callable

Returns a copy of this Callable with a number of arguments unbound. In other words, when the new callable is called the last few arguments supplied by the user are ignored, according to [param argcount]. The remaining arguments are passed to the callable. This allows to use the original callable in a context that attempts to pass more arguments than this callable can handle, e.g. a signal with a fixed number of arguments. See also [method bind]. [b]Note:[/b] When this method is chained with other similar methods, the order in which the argument list is modified is read from right to left. [codeblock] func _ready():

foo.unbind(1).call(1, 2) # Calls foo(1).
foo.bind(3, 4).unbind(1).call(1, 2) # Calls foo(1, 3, 4), note that it does not change the arguments from bind.

[/codeblock]

type CaretInfo

type CaretInfo struct {
	LeadingCaret, TrailingCaret Rect2

	LeadingDirection, TrailingDirection uint32
}

type Class

type Class[T, S IsClass] struct {
	KeepAlive Lifetime
	Temporary Lifetime
	// contains filtered or unexported fields
}

func (Class[T, S]) AsObject

func (class Class[T, S]) AsObject() Object

func (Class[T, S]) AsPointer

func (class Class[T, S]) AsPointer() Pointer

func (*Class[T, S]) GetKeepAlive

func (class *Class[T, S]) GetKeepAlive() Lifetime

func (Class[T, S]) Pin

func (class Class[T, S]) Pin() Lifetime

func (*Class[T, S]) SetKeepAlive

func (class *Class[T, S]) SetKeepAlive(godot Lifetime)

func (*Class[T, S]) SetPointer

func (class *Class[T, S]) SetPointer(ptr Pointer)

func (*Class[T, S]) SetTemporary

func (class *Class[T, S]) SetTemporary(godot Lifetime)

func (*Class[T, S]) Super

func (class *Class[T, S]) Super() *S

func (Class[T, S]) Virtual

func (class Class[T, S]) Virtual(s string) reflect.Value

type ClassInterface

type ClassInterface interface {
	IsVirtual() bool
	IsAbstract() bool
	IsExposed() bool

	CreateInstance() Object

	// ReloadInstance is used to reload an existing object instance
	// when the Go shared library is reloaded from the editor.
	ReloadInstance(Object) ObjectInterface

	GetVirtual(StringName) any
}

type ClassMethodArgumentMetadata

type ClassMethodArgumentMetadata uint32
const (
	ArgumentMetadataNone ClassMethodArgumentMetadata = iota
	ArgumentMetadataIntIsInt8
	ArgumentMetadataIntIsInt16
	ArgumentMetadataIntIsInt32
	ArgumentMetadataIntIsInt64
	ArgumentMetadataIntIsUint8
	ArgumentMetadataIntIsUint16
	ArgumentMetadataIntIsUint32
	ArgumentMetadataIntIsUint64
	ArgumentMetadataRealIsFloat32
	ArgumentMetadataRealIsFloat64
)

type ClassTag

type ClassTag uintptr

type ClockDirection

type ClockDirection int64

type Color

type Color = uc.Color

type Context

type Context = Lifetime

type Corner

type Corner int64

type Dictionary

type Dictionary mmm.Pointer[API, Dictionary, uintptr]

func (Dictionary) Clear

func (self Dictionary) Clear()

Clears the dictionary, removing all entries from it.

func (Dictionary) Duplicate

func (self Dictionary) Duplicate(ctx Lifetime, deep bool) Dictionary

Creates and returns a new copy of the dictionary. If [param deep] is [code]true[/code], inner Dictionary and Array keys and values are also copied, recursively.

func (Dictionary) Erase

func (self Dictionary) Erase(key Variant) bool

Removes the dictionary entry by key, if it exists. Returns [code]true[/code] if the given [param key] existed in the dictionary, otherwise [code]false[/code]. [b]Note:[/b] Do not erase entries while iterating over the dictionary. You can iterate over the [method keys] array instead.

func (Dictionary) FindKey

func (self Dictionary) FindKey(ctx Lifetime, value Variant) Variant

Finds and returns the first key whose associated value is equal to [param value], or [code]null[/code] if it is not found. [b]Note:[/b] [code]null[/code] is also a valid key. If inside the dictionary, [method find_key] may give misleading results.

func (Dictionary) Free

func (d Dictionary) Free()

func (Dictionary) Get

func (self Dictionary) Get(ctx Lifetime, key Variant, def Variant) Variant

Returns the corresponding value for the given [param key] in the dictionary. If the [param key] does not exist, returns [param default], or [code]null[/code] if the parameter is omitted.

func (Dictionary) GetOrAdd

func (self Dictionary) GetOrAdd(ctx Lifetime, key Variant, def Variant) Variant

Gets a value and ensures the key is set. If the [param key] exists in the dictionary, this behaves like [method get]. Otherwise, the [param default] value is inserted into the dictionary and returned.

func (Dictionary) Has

func (self Dictionary) Has(key Variant) bool

Returns [code]true[/code] if the dictionary contains an entry with the given [param key]. [codeblocks] [gdscript]

var my_dict = {
    "Godot" : 4,
    210 : null,
}

print(my_dict.has("Godot")) # Prints true print(my_dict.has(210)) # Prints true print(my_dict.has(4)) # Prints false [/gdscript] [csharp] var myDict = new Godot.Collections.Dictionary

{
    { "Godot", 4 },
    { 210, default },
};

GD.Print(myDict.ContainsKey("Godot")); // Prints true GD.Print(myDict.ContainsKey(210)); // Prints true GD.Print(myDict.ContainsKey(4)); // Prints false [/csharp] [/codeblocks] In GDScript, this is equivalent to the [code]in[/code] operator: [codeblock] if "Godot" in {"Godot": 4}:

print("The key is here!") # Will be printed.

[/codeblock] [b]Note:[/b] This method returns [code]true[/code] as long as the [param key] exists, even if its corresponding value is [code]null[/code].

func (Dictionary) HasAll

func (self Dictionary) HasAll(keys Array) bool

Returns [code]true[/code] if the dictionary contains all keys in the given [param keys] array. [codeblock] var data = {"width" : 10, "height" : 20} data.has_all(["height", "width"]) # Returns true [/codeblock]

func (Dictionary) Hash

func (self Dictionary) Hash() Int

Returns a hashed 32-bit integer value representing the dictionary contents. [codeblocks] [gdscript] var dict1 = {"A": 10, "B": 2} var dict2 = {"A": 10, "B": 2}

print(dict1.hash() == dict2.hash()) # Prints true [/gdscript] [csharp] var dict1 = new Godot.Collections.Dictionary{{"A", 10}, {"B", 2}}; var dict2 = new Godot.Collections.Dictionary{{"A", 10}, {"B", 2}};

// Godot.Collections.Dictionary has no Hash() method. Use GD.Hash() instead. GD.Print(GD.Hash(dict1) == GD.Hash(dict2)); // Prints true [/csharp] [/codeblocks] [b]Note:[/b] Dictionaries with the same entries but in a different order will not have the same hash. [b]Note:[/b] Dictionaries with equal hash values are [i]not[/i] guaranteed to be the same, because of hash collisions. On the contrary, dictionaries with different hash values are guaranteed to be different.

func (Dictionary) Index

func (d Dictionary) Index(ctx Lifetime, key Variant) Variant

func (Dictionary) IsEmpty

func (self Dictionary) IsEmpty() bool

Returns [code]true[/code] if the dictionary is empty (its size is [code]0[/code]). See also [method size].

func (Dictionary) IsReadOnly

func (self Dictionary) IsReadOnly() bool

Returns [code]true[/code] if the dictionary is read-only. See [method make_read_only]. Dictionaries are automatically read-only if declared with [code]const[/code] keyword.

func (Dictionary) Keys

func (self Dictionary) Keys(ctx Lifetime) Array

Returns the list of keys in the dictionary.

func (Dictionary) MakeReadOnly

func (self Dictionary) MakeReadOnly()

Makes the dictionary read-only, i.e. disables modification of the dictionary's contents. Does not apply to nested content, e.g. content of nested dictionaries.

func (Dictionary) Merge

func (self Dictionary) Merge(dictionary Dictionary, overwrite bool)

Adds entries from [param dictionary] to this dictionary. By default, duplicate keys are not copied over, unless [param overwrite] is [code]true[/code]. [codeblocks] [gdscript] var dict = { "item": "sword", "quantity": 2 } var other_dict = { "quantity": 15, "color": "silver" }

# Overwriting of existing keys is disabled by default. dict.merge(other_dict) print(dict) # { "item": "sword", "quantity": 2, "color": "silver" }

# With overwriting of existing keys enabled. dict.merge(other_dict, true) print(dict) # { "item": "sword", "quantity": 15, "color": "silver" } [/gdscript] [csharp] var dict = new Godot.Collections.Dictionary

{
    ["item"] = "sword",
    ["quantity"] = 2,
};

var otherDict = new Godot.Collections.Dictionary

{
    ["quantity"] = 15,
    ["color"] = "silver",
};

// Overwriting of existing keys is disabled by default. dict.Merge(otherDict); GD.Print(dict); // { "item": "sword", "quantity": 2, "color": "silver" }

// With overwriting of existing keys enabled. dict.Merge(otherDict, true); GD.Print(dict); // { "item": "sword", "quantity": 15, "color": "silver" } [/csharp] [/codeblocks] [b]Note:[/b] [method merge] is [i]not[/i] recursive. Nested dictionaries are considered as keys that can be overwritten or not depending on the value of [param overwrite], but they will never be merged together.

func (Dictionary) Merged

func (self Dictionary) Merged(ctx Lifetime, dictionary Dictionary, overwrite bool) Dictionary

Returns a copy of this dictionary merged with the other [param dictionary]. By default, duplicate keys are not copied over, unless [param overwrite] is [code]true[/code]. See also [method merge]. This method is useful for quickly making dictionaries with default values: [codeblock] var base = { "fruit": "apple", "vegetable": "potato" } var extra = { "fruit": "orange", "dressing": "vinegar" } # Prints { "fruit": "orange", "vegetable": "potato", "dressing": "vinegar" } print(extra.merged(base)) # Prints { "fruit": "apple", "vegetable": "potato", "dressing": "vinegar" } print(extra.merged(base, true)) [/codeblock]

func (Dictionary) RecursiveEqual

func (self Dictionary) RecursiveEqual(dictionary Dictionary, recursion_count Int) bool

Returns [code]true[/code] if the two dictionaries contain the same keys and values, inner Dictionary and Array keys and values are compared recursively.

func (Dictionary) SetIndex

func (d Dictionary) SetIndex(key Variant, value Variant)

func (Dictionary) Size

func (self Dictionary) Size() Int

Returns the number of entries in the dictionary. Empty dictionaries ([code]{ }[/code]) always return [code]0[/code]. See also [method is_empty].

func (Dictionary) Values

func (self Dictionary) Values(ctx Lifetime) Array

Returns the list of values in this dictionary.

type Error

type Error int64
const (
	/*Methods that return [enum Error] return [constant OK] when no error occurred.
	  Since [constant OK] has value 0, and all other error constants are positive integers, it can also be used in boolean checks.
	  [b]Example:[/b]
	  [codeblock]
	  var error = method_that_returns_error()
	  if error != OK:
	      printerr("Failure!")

	  # Or, alternatively:
	  if error:
	      printerr("Still failing!")
	  [/codeblock]
	  [b]Note:[/b] Many functions do not return an error code, but will print error messages to standard output.*/
	Ok Error = 0
	/*Generic error.*/
	Failed Error = 1
	/*Unavailable error.*/
	ErrUnavailable Error = 2
	/*Unconfigured error.*/
	ErrUnconfigured Error = 3
	/*Unauthorized error.*/
	ErrUnauthorized Error = 4
	/*Parameter range error.*/
	ErrParameterRangeError Error = 5
	/*Out of memory (OOM) error.*/
	ErrOutOfMemory Error = 6
	/*File: Not found error.*/
	ErrFileNotFound Error = 7
	/*File: Bad drive error.*/
	ErrFileBadDrive Error = 8
	/*File: Bad path error.*/
	ErrFileBadPath Error = 9
	/*File: No permission error.*/
	ErrFileNoPermission Error = 10
	/*File: Already in use error.*/
	ErrFileAlreadyInUse Error = 11
	/*File: Can't open error.*/
	ErrFileCantOpen Error = 12
	/*File: Can't write error.*/
	ErrFileCantWrite Error = 13
	/*File: Can't read error.*/
	ErrFileCantRead Error = 14
	/*File: Unrecognized error.*/
	ErrFileUnrecognized Error = 15
	/*File: Corrupt error.*/
	ErrFileCorrupt Error = 16
	/*File: Missing dependencies error.*/
	ErrFileMissingDependencies Error = 17
	/*File: End of file (EOF) error.*/
	ErrFileEof Error = 18
	/*Can't open error.*/
	ErrCantOpen Error = 19
	/*Can't create error.*/
	ErrCantCreate Error = 20
	/*Query failed error.*/
	ErrQueryFailed Error = 21
	/*Already in use error.*/
	ErrAlreadyInUse Error = 22
	/*Locked error.*/
	ErrLocked Error = 23
	/*Timeout error.*/
	ErrTimeout Error = 24
	/*Can't connect error.*/
	ErrCantConnect Error = 25
	/*Can't resolve error.*/
	ErrCantResolve Error = 26
	/*Connection error.*/
	ErrConnectionError Error = 27
	/*Can't acquire resource error.*/
	ErrCantAcquireResource Error = 28
	/*Can't fork process error.*/
	ErrCantFork Error = 29
	/*Invalid data error.*/
	ErrInvalidData Error = 30
	/*Invalid parameter error.*/
	ErrInvalidParameter Error = 31
	/*Already exists error.*/
	ErrAlreadyExists Error = 32
	/*Does not exist error.*/
	ErrDoesNotExist Error = 33
	/*Database: Read error.*/
	ErrDatabaseCantRead Error = 34
	/*Database: Write error.*/
	ErrDatabaseCantWrite Error = 35
	/*Compilation failed error.*/
	ErrCompilationFailed Error = 36
	/*Method not found error.*/
	ErrMethodNotFound Error = 37
	/*Linking failed error.*/
	ErrLinkFailed Error = 38
	/*Script failed error.*/
	ErrScriptFailed Error = 39
	/*Cycling link (import cycle) error.*/
	ErrCyclicLink Error = 40
	/*Invalid declaration error.*/
	ErrInvalidDeclaration Error = 41
	/*Duplicate symbol error.*/
	ErrDuplicateSymbol Error = 42
	/*Parse error.*/
	ErrParseError Error = 43
	/*Busy error.*/
	ErrBusy Error = 44
	/*Skip error.*/
	ErrSkip Error = 45
	/*Help error. Used internally when passing [code]--version[/code] or [code]--help[/code] as executable options.*/
	ErrHelp Error = 46
	/*Bug error, caused by an implementation issue in the method.
	  [b]Note:[/b] If a built-in method returns this code, please open an issue on [url=https://github.com/godotengine/godot/issues]the GitHub Issue Tracker[/url].*/
	ErrBug Error = 47
	/*Printer on fire error (This is an easter egg, no built-in methods return this error code).*/
	ErrPrinterOnFire Error = 48
)

func (Error) Error

func (err Error) Error() string

type EulerOrder

type EulerOrder = xy.EulerOrder

type Extends

type Extends[T IsClass] interface {
	IsClass
	// contains filtered or unexported methods
}

type ExtensionClass

type ExtensionClass interface {
	PointerToClass
	SetKeepAlive(Lifetime)
	GetKeepAlive() Lifetime
	SetTemporary(Lifetime)
}

type ExtensionClassCallVirtualFunc

type ExtensionClassCallVirtualFunc func(ExtensionClass, UnsafeArgs, UnsafeBack)

type ExtensionToken

type ExtensionToken uintptr

type Float

type Float = float64

type GDExtensionInitializationLevel

type GDExtensionInitializationLevel int64
const (
	GDExtensionInitializationLevelCore    GDExtensionInitializationLevel = 0
	GDExtensionInitializationLevelServers GDExtensionInitializationLevel = 1
	GDExtensionInitializationLevelScene   GDExtensionInitializationLevel = 2
	GDExtensionInitializationLevelEditor  GDExtensionInitializationLevel = 3
)

type Glyph

type Glyph struct {
	Start    int32
	End      int32
	Count    uint8
	Repeat   uint8
	Flags    uint16
	Xoffset  float32
	Yoffset  float32
	Advance  float32
	FontRID  RID
	FontSize int32
	Index    int32
}

type HorizontalAlignment

type HorizontalAlignment int64

type InlineAlignment

type InlineAlignment int64

type InstanceBindingType

type InstanceBindingType unsafe.Pointer

type InstanceID

type InstanceID uint64

type Int

type Int = int64

type IsArray

type IsArray interface {
	mmm.ManagedPointer[uintptr]
	// contains filtered or unexported methods
}

type IsArrayType

type IsArrayType[T any] interface {
	Typed(TypedArray[T])
	Array() Array
}

type IsClass

type IsClass interface {
	AsPointer() Pointer
	Virtual(string) reflect.Value
	AsObject() Object
}

type IsPointer

type IsPointer interface {
	AsPointer() Pointer
}

type IsSignal

type IsSignal interface {
	// contains filtered or unexported methods
}

type Iterator

type Iterator struct {
	// contains filtered or unexported fields
}

func (Iterator) Next

func (iter Iterator) Next() bool

func (Iterator) Value

func (iter Iterator) Value(ctx Lifetime) Variant

type JoyAxis

type JoyAxis int64

type JoyButton

type JoyButton int64

type Key

type Key int64

type KeyLocation

type KeyLocation int64

type KeyModifierMask

type KeyModifierMask int64

type Lifetime

type Lifetime struct {
	mmm.Lifetime

	API *API
}

Lifetime for ownership and a reference to the Godot API, apart from its use as an ordinary context.Lifetime to signal cancellation, this value is not safe to use concurrently. Each goroutine should create its own Lifetime and use that instead.

newctx := gd.NewLifetime(oldctx.API())

When a Lifetime is freed, it will free all of the objects that were created using it. A Lifetime should not be used after free, as it will be recycled and will cause values to be unexpectedly freed.

When the context has been passed in as a function argument, always assume that the Lifetime will be freed when the function returns. Classes can be moved between contexts using their [KeepAlive] method.

func NewContext

func NewContext(api *API) Lifetime

NewContext returns a new Lifetime with the given API, the Lifetime will need to be freed manually by calling Lifetime.Free.

func NewLifetime

func NewLifetime(api *API) Lifetime

NewLifetime returns a new Lifetime with the given API, the Lifetime will need to be freed manually by calling Lifetime.Free.

func (Lifetime) Abs

func (ctx Lifetime) Abs(x Variant) Variant

func (Lifetime) Absf

func (ctx Lifetime) Absf(x Float) Float

func (Lifetime) Absi

func (ctx Lifetime) Absi(x Int) Int

func (Lifetime) Acos

func (ctx Lifetime) Acos(x Float) Float

func (Lifetime) Acosh

func (ctx Lifetime) Acosh(x Float) Float

func (Lifetime) AngleDifference

func (ctx Lifetime) AngleDifference(from Float, to Float) Float

func (Lifetime) Array

func (godot Lifetime) Array() Array

func (Lifetime) Asin

func (ctx Lifetime) Asin(x Float) Float

func (Lifetime) Asinh

func (ctx Lifetime) Asinh(x Float) Float

func (Lifetime) Atan

func (ctx Lifetime) Atan(x Float) Float

func (Lifetime) Atan2

func (ctx Lifetime) Atan2(y Float, x Float) Float

func (Lifetime) Atanh

func (ctx Lifetime) Atanh(x Float) Float

func (Lifetime) BezierDerivative

func (ctx Lifetime) BezierDerivative(start Float, control_1 Float, control_2 Float, end Float, t Float) Float

func (Lifetime) BezierInterpolate

func (ctx Lifetime) BezierInterpolate(start Float, control_1 Float, control_2 Float, end Float, t Float) Float

func (Lifetime) BytesToVar

func (ctx Lifetime) BytesToVar(bytes PackedByteArray) Variant

func (Lifetime) BytesToVarWithObjects

func (ctx Lifetime) BytesToVarWithObjects(bytes PackedByteArray) Variant

func (Lifetime) Callable

func (godot Lifetime) Callable(fn any) Callable

Callable creates a new callable out of the given function which must only accept godot-compatible types and return up to one godot-compatible type.

func (Lifetime) Ceil

func (ctx Lifetime) Ceil(x Variant) Variant

func (Lifetime) Ceilf

func (ctx Lifetime) Ceilf(x Float) Float

func (Lifetime) Ceili

func (ctx Lifetime) Ceili(x Float) Int

func (Lifetime) Clamp

func (ctx Lifetime) Clamp(value Variant, min Variant, max Variant) Variant

func (Lifetime) Clampf

func (ctx Lifetime) Clampf(value Float, min Float, max Float) Float

func (Lifetime) Clampi

func (ctx Lifetime) Clampi(value Int, min Int, max Int) Int

func (Lifetime) Cos

func (ctx Lifetime) Cos(angle_rad Float) Float

func (Lifetime) Cosh

func (ctx Lifetime) Cosh(x Float) Float

func (Lifetime) CubicInterpolate

func (ctx Lifetime) CubicInterpolate(from Float, to Float, pre Float, post Float, weight Float) Float

func (Lifetime) CubicInterpolateAngle

func (ctx Lifetime) CubicInterpolateAngle(from Float, to Float, pre Float, post Float, weight Float) Float

func (Lifetime) CubicInterpolateAngleInTime

func (ctx Lifetime) CubicInterpolateAngleInTime(from Float, to Float, pre Float, post Float, weight Float, to_t Float, pre_t Float, post_t Float) Float

func (Lifetime) CubicInterpolateInTime

func (ctx Lifetime) CubicInterpolateInTime(from Float, to Float, pre Float, post Float, weight Float, to_t Float, pre_t Float, post_t Float) Float

func (Lifetime) DbToLinear

func (ctx Lifetime) DbToLinear(db Float) Float

func (Lifetime) DegToRad

func (ctx Lifetime) DegToRad(deg Float) Float

func (Lifetime) Dictionary

func (godot Lifetime) Dictionary() Dictionary

func (Lifetime) Ease

func (ctx Lifetime) Ease(x Float, curve Float) Float

func (Lifetime) End

func (godot Lifetime) End()

func (Lifetime) ErrorString

func (ctx Lifetime) ErrorString(error Int) String

func (Lifetime) Exp

func (ctx Lifetime) Exp(x Float) Float

func (Lifetime) Floor

func (ctx Lifetime) Floor(x Variant) Variant

func (Lifetime) Floorf

func (ctx Lifetime) Floorf(x Float) Float

func (Lifetime) Floori

func (ctx Lifetime) Floori(x Float) Int

func (Lifetime) Fmod

func (ctx Lifetime) Fmod(x Float, y Float) Float

func (Lifetime) Fposmod

func (ctx Lifetime) Fposmod(x Float, y Float) Float

func (Lifetime) Free

func (godot Lifetime) Free()

func (Lifetime) GetLibraryPath

func (godot Lifetime) GetLibraryPath() string

GetLibraryPath returns the path to the library that was loaded.

func (Lifetime) Hash

func (ctx Lifetime) Hash(variable Variant) Int

func (Lifetime) InstanceFromId

func (ctx Lifetime) InstanceFromId(instance_id Int) Object

func (Lifetime) InverseLerp

func (ctx Lifetime) InverseLerp(from Float, to Float, weight Float) Float

func (Lifetime) IsEqualApprox

func (ctx Lifetime) IsEqualApprox(a Float, b Float) bool

func (Lifetime) IsFinite

func (ctx Lifetime) IsFinite(x Float) bool

func (Lifetime) IsInf

func (ctx Lifetime) IsInf(x Float) bool

func (Lifetime) IsInstanceIdValid

func (ctx Lifetime) IsInstanceIdValid(id Int) bool

func (Lifetime) IsInstanceValid

func (ctx Lifetime) IsInstanceValid(instance Variant) bool

func (Lifetime) IsNan

func (ctx Lifetime) IsNan(x Float) bool

func (Lifetime) IsSame

func (ctx Lifetime) IsSame(a Variant, b Variant) bool

func (Lifetime) IsZeroApprox

func (ctx Lifetime) IsZeroApprox(x Float) bool

func (Lifetime) Lerp

func (ctx Lifetime) Lerp(from Variant, to Variant, weight Variant) Variant

func (Lifetime) LerpAngle

func (ctx Lifetime) LerpAngle(from Float, to Float, weight Float) Float

func (Lifetime) Lerpf

func (ctx Lifetime) Lerpf(from Float, to Float, weight Float) Float

func (Lifetime) LinearToDb

func (ctx Lifetime) LinearToDb(lin Float) Float

func (Lifetime) Log

func (ctx Lifetime) Log(x Float) Float

func (Lifetime) Max

func (ctx Lifetime) Max(arg1 Variant, arg2 Variant, args ...Variant) Variant

func (Lifetime) Maxf

func (ctx Lifetime) Maxf(a Float, b Float) Float

func (Lifetime) Maxi

func (ctx Lifetime) Maxi(a Int, b Int) Int

func (Lifetime) Min

func (ctx Lifetime) Min(arg1 Variant, arg2 Variant, args ...Variant) Variant

func (Lifetime) Minf

func (ctx Lifetime) Minf(a Float, b Float) Float

func (Lifetime) Mini

func (ctx Lifetime) Mini(a Int, b Int) Int

func (Lifetime) MoveToward

func (ctx Lifetime) MoveToward(from Float, to Float, delta Float) Float

func (Lifetime) NearestPo2

func (ctx Lifetime) NearestPo2(value Int) Int

func (Lifetime) PackedByteArray

func (godot Lifetime) PackedByteArray() PackedByteArray

func (Lifetime) PackedByteSlice

func (godot Lifetime) PackedByteSlice(data []byte) PackedByteArray

PackedByteSlice returns a PackedByteArray from a byte slice.

func (Lifetime) PackedColorArray

func (godot Lifetime) PackedColorArray() PackedColorArray

func (Lifetime) PackedColorSlice

func (godot Lifetime) PackedColorSlice(data []uc.Color) PackedColorArray

func (Lifetime) PackedFloat32Array

func (godot Lifetime) PackedFloat32Array() PackedFloat32Array

func (Lifetime) PackedFloat32Slice

func (godot Lifetime) PackedFloat32Slice(data []float32) PackedFloat32Array

func (Lifetime) PackedFloat64Array

func (godot Lifetime) PackedFloat64Array() PackedFloat64Array

func (Lifetime) PackedFloat64Slice

func (godot Lifetime) PackedFloat64Slice(data []float64) PackedFloat64Array

func (Lifetime) PackedInt32Array

func (godot Lifetime) PackedInt32Array() PackedInt32Array

func (Lifetime) PackedInt32Slice

func (godot Lifetime) PackedInt32Slice(data []int32) PackedInt32Array

func (Lifetime) PackedInt64Array

func (godot Lifetime) PackedInt64Array() PackedInt64Array

func (Lifetime) PackedInt64Slice

func (godot Lifetime) PackedInt64Slice(data []int64) PackedInt64Array

func (Lifetime) PackedStringArray

func (godot Lifetime) PackedStringArray() PackedStringArray

func (Lifetime) PackedStringSlice

func (godot Lifetime) PackedStringSlice(data []string) PackedStringArray

func (Lifetime) PackedVector2Array

func (godot Lifetime) PackedVector2Array() PackedVector2Array

func (Lifetime) PackedVector2Slice

func (godot Lifetime) PackedVector2Slice(data []Vector2) PackedVector2Array

func (Lifetime) PackedVector3Array

func (godot Lifetime) PackedVector3Array() PackedVector3Array

func (Lifetime) PackedVector3Slice

func (godot Lifetime) PackedVector3Slice(data []Vector3) PackedVector3Array

func (Lifetime) PackedVector4Array

func (godot Lifetime) PackedVector4Array() PackedVector4Array

func (Lifetime) PackedVector4Slice

func (godot Lifetime) PackedVector4Slice(data []Vector4) PackedVector4Array

func (Lifetime) Pingpong

func (ctx Lifetime) Pingpong(value Float, length Float) Float

func (Lifetime) Posmod

func (ctx Lifetime) Posmod(x Int, y Int) Int

func (Lifetime) Pow

func (ctx Lifetime) Pow(base Float, exp Float) Float

func (Lifetime) Print

func (ctx Lifetime) Print(arg1 Variant, args ...Variant)

func (Lifetime) PrintRich

func (ctx Lifetime) PrintRich(arg1 Variant, args ...Variant)

func (Lifetime) PrintVerbose

func (ctx Lifetime) PrintVerbose(arg1 Variant, args ...Variant)

func (Lifetime) Printerr

func (ctx Lifetime) Printerr(arg1 Variant, args ...Variant)

func (Lifetime) Printraw

func (ctx Lifetime) Printraw(arg1 Variant, args ...Variant)

func (Lifetime) Prints

func (ctx Lifetime) Prints(arg1 Variant, args ...Variant)

func (Lifetime) Printt

func (ctx Lifetime) Printt(arg1 Variant, args ...Variant)

func (Lifetime) PushError

func (ctx Lifetime) PushError(arg1 Variant, args ...Variant)

func (Lifetime) PushWarning

func (ctx Lifetime) PushWarning(arg1 Variant, args ...Variant)

func (Lifetime) RadToDeg

func (ctx Lifetime) RadToDeg(rad Float) Float

func (Lifetime) RandFromSeed

func (ctx Lifetime) RandFromSeed(seed Int) PackedInt64Array

func (Lifetime) Randf

func (ctx Lifetime) Randf() Float

func (Lifetime) RandfRange

func (ctx Lifetime) RandfRange(from Float, to Float) Float

func (Lifetime) Randfn

func (ctx Lifetime) Randfn(mean Float, deviation Float) Float

func (Lifetime) Randi

func (ctx Lifetime) Randi() Int

func (Lifetime) RandiRange

func (ctx Lifetime) RandiRange(from Int, to Int) Int

func (Lifetime) Randomize

func (ctx Lifetime) Randomize()

func (Lifetime) Recover

func (godot Lifetime) Recover()

func (Lifetime) Register

func (godot Lifetime) Register(spec Registrable)

func (Lifetime) Remap

func (ctx Lifetime) Remap(value Float, istart Float, istop Float, ostart Float, ostop Float) Float

func (Lifetime) RidAllocateId

func (ctx Lifetime) RidAllocateId() Int

func (Lifetime) RidFromInt64

func (ctx Lifetime) RidFromInt64(base Int) RID

func (Lifetime) RotateToward

func (ctx Lifetime) RotateToward(from Float, to Float, delta Float) Float

func (Lifetime) Round

func (ctx Lifetime) Round(x Variant) Variant

func (Lifetime) Roundf

func (ctx Lifetime) Roundf(x Float) Float

func (Lifetime) Roundi

func (ctx Lifetime) Roundi(x Float) Int

func (Lifetime) Seed

func (ctx Lifetime) Seed(base Int)

func (Lifetime) Sign

func (ctx Lifetime) Sign(x Variant) Variant

func (*Lifetime) SignalOf

func (Godot *Lifetime) SignalOf(ctx Lifetime, object Object, signal StringName) Signal

func (Lifetime) Signf

func (ctx Lifetime) Signf(x Float) Float

func (Lifetime) Signi

func (ctx Lifetime) Signi(x Int) Int

func (Lifetime) Sin

func (ctx Lifetime) Sin(angle_rad Float) Float

func (Lifetime) Sinh

func (ctx Lifetime) Sinh(x Float) Float

func (Lifetime) Smoothstep

func (ctx Lifetime) Smoothstep(from Float, to Float, x Float) Float

func (Lifetime) Snapped

func (ctx Lifetime) Snapped(x Variant, step Variant) Variant

func (Lifetime) Snappedf

func (ctx Lifetime) Snappedf(x Float, step Float) Float

func (Lifetime) Snappedi

func (ctx Lifetime) Snappedi(x Float, step Int) Int

func (Lifetime) Sqrt

func (ctx Lifetime) Sqrt(x Float) Float

func (Lifetime) StepDecimals

func (ctx Lifetime) StepDecimals(x Float) Int

func (Lifetime) Str

func (ctx Lifetime) Str(arg1 Variant, args ...Variant) String

func (Lifetime) StrToVar

func (ctx Lifetime) StrToVar(s String) Variant

func (Lifetime) String

func (godot Lifetime) String(s string) String

String returns a String from a standard UTF8 Go string.

func (Lifetime) StringName

func (godot Lifetime) StringName(s string) StringName

StringName returns a StringName from a standard UTF8 Go string.

func (Lifetime) Tan

func (ctx Lifetime) Tan(angle_rad Float) Float

func (Lifetime) Tanh

func (ctx Lifetime) Tanh(x Float) Float

func (Lifetime) TypeConvert

func (ctx Lifetime) TypeConvert(variant Variant, atype Int) Variant

func (Lifetime) TypeToString

func (ctx Lifetime) TypeToString(atype Int) String

func (Lifetime) Typeof

func (ctx Lifetime) Typeof(variable Variant) Int

func (Lifetime) VarToBytes

func (ctx Lifetime) VarToBytes(variable Variant) PackedByteArray

func (Lifetime) VarToBytesWithObjects

func (ctx Lifetime) VarToBytesWithObjects(variable Variant) PackedByteArray

func (Lifetime) VarToStr

func (ctx Lifetime) VarToStr(variable Variant) String

func (Lifetime) Variant

func (godot Lifetime) Variant(v any) Variant

Variant returns a variant from the given value, which must be one of the basic godot types defined in the gd package.

func (Lifetime) Version

func (godot Lifetime) Version() Version

Version returns the version of the Godot API that we are linked in to.

func (Lifetime) Weakref

func (ctx Lifetime) Weakref(obj Variant) Variant

func (Lifetime) Wrap

func (ctx Lifetime) Wrap(value Variant, min Variant, max Variant) Variant

func (Lifetime) Wrapf

func (ctx Lifetime) Wrapf(value Float, min Float, max Float) Float

func (Lifetime) Wrapi

func (ctx Lifetime) Wrapi(value Int, min Int, max Int) Int

type MIDIMessage

type MIDIMessage int64

type Method

type Method struct {
	Name                StringName
	Call                func(Lifetime, any, ...Variant) (Variant, error)
	PointerCall         func(any, UnsafeArgs, UnsafeBack)
	MethodFlags         MethodFlags
	ReturnValueInfo     *PropertyInfo
	ReturnValueMetadata ClassMethodArgumentMetadata

	Arguments         []PropertyInfo
	ArgumentsMetadata []ClassMethodArgumentMetadata

	DefaultArguments []Variant
}

type MethodBind

type MethodBind uintptr

type MethodFlags

type MethodFlags int64

type MethodInfo

type MethodInfo struct {
	Name             StringName
	ReturnValue      PropertyInfo
	Flags            MethodFlags
	ID               int32
	Arguments        []PropertyInfo
	DefaultArguments []Variant
}

type MouseButton

type MouseButton int64

type MouseButtonMask

type MouseButtonMask int64

type NodePath

type NodePath mmm.Pointer[API, NodePath, uintptr]

func (NodePath) Free

func (n NodePath) Free()

func (NodePath) GetAsPropertyPath

func (self NodePath) GetAsPropertyPath(ctx Lifetime) NodePath

Returns a copy of this node path with a colon character ([code]:[/code]) prefixed, transforming it to a pure property path with no node names (relative to the current node). [codeblocks] [gdscript] # node_path points to the "x" property of the child node named "position". var node_path = ^"position:x"

# property_path points to the "position" in the "x" axis of this node. var property_path = node_path.get_as_property_path() print(property_path) # Prints ":position:x" [/gdscript] [csharp] // nodePath points to the "x" property of the child node named "position". var nodePath = new NodePath("position:x");

// propertyPath points to the "position" in the "x" axis of this node. NodePath propertyPath = nodePath.GetAsPropertyPath(); GD.Print(propertyPath); // Prints ":position:x". [/csharp] [/codeblocks]

func (NodePath) GetConcatenatedNames

func (self NodePath) GetConcatenatedNames(ctx Lifetime) StringName

Returns all node names concatenated with a slash character ([code]/[/code]) as a single StringName.

func (NodePath) GetConcatenatedSubnames

func (self NodePath) GetConcatenatedSubnames(ctx Lifetime) StringName

Returns all property subnames concatenated with a colon character ([code]:[/code]) as a single StringName. [codeblocks] [gdscript] var node_path = ^"Sprite2D:texture:resource_name" print(node_path.get_concatenated_subnames()) # Prints "texture:resource_name". [/gdscript] [csharp] var nodePath = new NodePath("Sprite2D:texture:resource_name"); GD.Print(nodePath.GetConcatenatedSubnames()); // Prints "texture:resource_name". [/csharp] [/codeblocks]

func (NodePath) GetName

func (self NodePath) GetName(ctx Lifetime, idx Int) StringName

Returns the node name indicated by [param idx], starting from 0. If [param idx] is out of bounds, an error is generated. See also [method get_subname_count] and [method get_name_count]. [codeblocks] [gdscript] var sprite_path = NodePath("../RigidBody2D/Sprite2D") print(sprite_path.get_name(0)) # Prints "..". print(sprite_path.get_name(1)) # Prints "RigidBody2D". print(sprite_path.get_name(2)) # Prints "Sprite". [/gdscript] [csharp] var spritePath = new NodePath("../RigidBody2D/Sprite2D"); GD.Print(spritePath.GetName(0)); // Prints "..". GD.Print(spritePath.GetName(1)); // Prints "PathFollow2D". GD.Print(spritePath.GetName(2)); // Prints "Sprite". [/csharp] [/codeblocks]

func (NodePath) GetNameCount

func (self NodePath) GetNameCount() Int

Returns the number of node names in the path. Property subnames are not included. For example, [code]"../RigidBody2D/Sprite2D:texture"[/code] contains 3 node names.

func (NodePath) GetSubname

func (self NodePath) GetSubname(ctx Lifetime, idx Int) StringName

Returns the property name indicated by [param idx], starting from 0. If [param idx] is out of bounds, an error is generated. See also [method get_subname_count]. [codeblocks] [gdscript] var path_to_name = NodePath("Sprite2D:texture:resource_name") print(path_to_name.get_subname(0)) # Prints "texture". print(path_to_name.get_subname(1)) # Prints "resource_name". [/gdscript] [csharp] var pathToName = new NodePath("Sprite2D:texture:resource_name"); GD.Print(pathToName.GetSubname(0)); // Prints "texture". GD.Print(pathToName.GetSubname(1)); // Prints "resource_name". [/csharp] [/codeblocks]

func (NodePath) GetSubnameCount

func (self NodePath) GetSubnameCount() Int

Returns the number of property names ("subnames") in the path. Each subname in the node path is listed after a colon character ([code]:[/code]). For example, [code]"Level/RigidBody2D/Sprite2D:texture:resource_name"[/code] contains 2 subnames.

func (NodePath) Hash

func (self NodePath) Hash() Int

Returns the 32-bit hash value representing the node path's contents. [b]Note:[/b] Node paths with equal hash values are [i]not[/i] guaranteed to be the same, as a result of hash collisions. Node paths with different hash values are guaranteed to be different.

func (NodePath) IsAbsolute

func (self NodePath) IsAbsolute() bool

Returns [code]true[/code] if the node path is absolute. Unlike a relative path, an absolute path is represented by a leading slash character ([code]/[/code]) and always begins from the [SceneTree]. It can be used to reliably access nodes from the root node (e.g. [code]"/root/Global"[/code] if an autoload named "Global" exists).

func (NodePath) IsEmpty

func (self NodePath) IsEmpty() bool

Returns [code]true[/code] if the node path has been constructed from an empty String ([code]""[/code]).

func (NodePath) Slice

func (self NodePath) Slice(ctx Lifetime, begin Int, end Int) NodePath

Returns the slice of the NodePath, from [param begin] (inclusive) to [param end] (exclusive), as a new NodePath. The absolute value of [param begin] and [param end] will be clamped to the sum of [method get_name_count] and [method get_subname_count], so the default value for [param end] makes it slice to the end of the NodePath by default (i.e. [code]path.slice(1)[/code] is a shorthand for [code]path.slice(1, path.get_name_count() + path.get_subname_count())[/code]). If either [param begin] or [param end] are negative, they will be relative to the end of the NodePath (i.e. [code]path.slice(0, -2)[/code] is a shorthand for [code]path.slice(0, path.get_name_count() + path.get_subname_count() - 2)[/code]).

type NotificationType

type NotificationType int32

type Object

type Object struct {
	// contains filtered or unexported fields
}

func (Object) AddUserSignal

func (self Object) AddUserSignal(signal String, arguments Array)

Adds a user-defined [param signal]. Optional arguments for the signal can be added as an Array of dictionaries, each defining a [code]name[/code] String and a [code]type[/code] [int] (see [enum Variant.Type]). See also [method has_user_signal] and [method remove_user_signal]. [codeblocks] [gdscript] add_user_signal("hurt", [

{ "name": "damage", "type": TYPE_INT },
{ "name": "source", "type": TYPE_OBJECT }

]) [/gdscript] [csharp] AddUserSignal("Hurt", new Godot.Collections.Array()

{
    new Godot.Collections.Dictionary()
    {
        { "name", "damage" },
        { "type", (int)Variant.Type.Int }
    },
    new Godot.Collections.Dictionary()
    {
        { "name", "source" },
        { "type", (int)Variant.Type.Object }
    }
});

[/csharp] [/codeblocks]

func (Object) AsObject

func (self Object) AsObject() Object

func (Object) AsPointer

func (o Object) AsPointer() Pointer

func (Object) Callv

func (self Object) Callv(ctx Lifetime, method StringName, arg_array Array) Variant

Calls the [param method] on the object and returns the result. Unlike [method call], this method expects all parameters to be contained inside [param arg_array]. [codeblocks] [gdscript] var node = Node3D.new() node.callv("rotate", [Vector3(1.0, 0.0, 0.0), 1.571]) [/gdscript] [csharp] var node = new Node3D(); node.Callv(Node3D.MethodName.Rotate, new Godot.Collections.Array { new Vector3(1f, 0f, 0f), 1.571f }); [/csharp] [/codeblocks] [b]Note:[/b] In C#, [param method] must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the [code]MethodName[/code] class to avoid allocating a new StringName on each call.

func (Object) CanTranslateMessages

func (self Object) CanTranslateMessages() bool

Returns [code]true[/code] if the object is allowed to translate messages with [method tr] and [method tr_n]. See also [method set_message_translation].

func (Object) CancelFree

func (self Object) CancelFree()

If this method is called during [constant NOTIFICATION_PREDELETE], this object will reject being freed and will remain allocated. This is mostly an internal function used for error handling to avoid the user from freeing objects when they are not intended to.

func (Object) Connect

func (self Object) Connect(signal StringName, callable Callable, flags Int) int64

Connects a [param signal] by name to a [param callable]. Optional [param flags] can be also added to configure the connection's behavior (see [enum ConnectFlags] constants). A signal can only be connected once to the same Callable. If the signal is already connected, this method returns [constant ERR_INVALID_PARAMETER] and pushes an error message, unless the signal is connected with [constant CONNECT_REFERENCE_COUNTED]. To prevent this, use [method is_connected] first to check for existing connections. If the [param callable]'s object is freed, the connection will be lost. [b]Examples with recommended syntax:[/b] Connecting signals is one of the most common operations in Godot and the API gives many options to do so, which are described further down. The code block below shows the recommended approach. [codeblocks] [gdscript] func _ready():

var button = Button.new()
# `button_down` here is a Signal variant type, and we thus call the Signal.connect() method, not Object.connect().
# See discussion below for a more in-depth overview of the API.
button.button_down.connect(_on_button_down)

# This assumes that a `Player` class exists, which defines a `hit` signal.
var player = Player.new()
# We use Signal.connect() again, and we also use the Callable.bind() method,
# which returns a new Callable with the parameter binds.
player.hit.connect(_on_player_hit.bind("sword", 100))

func _on_button_down():

print("Button down!")

func _on_player_hit(weapon_type, damage):

print("Hit with weapon %s for %d damage." % [weapon_type, damage])

[/gdscript] [csharp] public override void _Ready()

{
    var button = new Button();
    // C# supports passing signals as events, so we can use this idiomatic construct:
    button.ButtonDown += OnButtonDown;

    // This assumes that a `Player` class exists, which defines a `Hit` signal.
    var player = new Player();
    // We can use lambdas when we need to bind additional parameters.
    player.Hit += () => OnPlayerHit("sword", 100);
}

private void OnButtonDown()

{
    GD.Print("Button down!");
}

private void OnPlayerHit(string weaponType, int damage)

{
    GD.Print($"Hit with weapon {weaponType} for {damage} damage.");
}

[/csharp] [/codeblocks] [b][code skip-lint]Object.connect()[/code] or [code skip-lint]Signal.connect()[/code]?[/b] As seen above, the recommended method to connect signals is not [method Object.connect]. The code block below shows the four options for connecting signals, using either this legacy method or the recommended [method Signal.connect], and using either an implicit Callable or a manually defined one. [codeblocks] [gdscript] func _ready():

var button = Button.new()
# Option 1: Object.connect() with an implicit Callable for the defined function.
button.connect("button_down", _on_button_down)
# Option 2: Object.connect() with a constructed Callable using a target object and method name.
button.connect("button_down", Callable(self, "_on_button_down"))
# Option 3: Signal.connect() with an implicit Callable for the defined function.
button.button_down.connect(_on_button_down)
# Option 4: Signal.connect() with a constructed Callable using a target object and method name.
button.button_down.connect(Callable(self, "_on_button_down"))

func _on_button_down():

print("Button down!")

[/gdscript] [csharp] public override void _Ready()

{
    var button = new Button();
    // Option 1: In C#, we can use signals as events and connect with this idiomatic syntax:
    button.ButtonDown += OnButtonDown;
    // Option 2: GodotObject.Connect() with a constructed Callable from a method group.
    button.Connect(Button.SignalName.ButtonDown, Callable.From(OnButtonDown));
    // Option 3: GodotObject.Connect() with a constructed Callable using a target object and method name.
    button.Connect(Button.SignalName.ButtonDown, new Callable(this, MethodName.OnButtonDown));
}

private void OnButtonDown()

{
    GD.Print("Button down!");
}

[/csharp] [/codeblocks] While all options have the same outcome ([code]button[/code]'s [signal BaseButton.button_down] signal will be connected to [code]_on_button_down[/code]), [b]option 3[/b] offers the best validation: it will print a compile-time error if either the [code]button_down[/code] Signal or the [code]_on_button_down[/code] Callable are not defined. On the other hand, [b]option 2[/b] only relies on string names and will only be able to validate either names at runtime: it will print a runtime error if [code]"button_down"[/code] doesn't correspond to a signal, or if [code]"_on_button_down"[/code] is not a registered method in the object [code]self[/code]. The main reason for using options 1, 2, or 4 would be if you actually need to use strings (e.g. to connect signals programmatically based on strings read from a configuration file). Otherwise, option 3 is the recommended (and fastest) method. [b]Binding and passing parameters:[/b] The syntax to bind parameters is through [method Callable.bind], which returns a copy of the Callable with its parameters bound. When calling [method emit_signal] or [method Signal.emit], the signal parameters can be also passed. The examples below show the relationship between these signal parameters and bound parameters. [codeblocks] [gdscript] func _ready():

# This assumes that a `Player` class exists, which defines a `hit` signal.
var player = Player.new()
# Using Callable.bind().
player.hit.connect(_on_player_hit.bind("sword", 100))

# Parameters added when emitting the signal are passed first.
player.hit.emit("Dark lord", 5)

# We pass two arguments when emitting (`hit_by`, `level`), # and bind two more arguments when connecting (`weapon_type`, `damage`). func _on_player_hit(hit_by, level, weapon_type, damage):

print("Hit by %s (level %d) with weapon %s for %d damage." % [hit_by, level, weapon_type, damage])

[/gdscript] [csharp] public override void _Ready()

{
    // This assumes that a `Player` class exists, which defines a `Hit` signal.
    var player = new Player();
    // Using lambda expressions that create a closure that captures the additional parameters.
    // The lambda only receives the parameters defined by the signal's delegate.
    player.Hit += (hitBy, level) => OnPlayerHit(hitBy, level, "sword", 100);

    // Parameters added when emitting the signal are passed first.
    player.EmitSignal(SignalName.Hit, "Dark lord", 5);
}

// We pass two arguments when emitting (`hit_by`, `level`), // and bind two more arguments when connecting (`weapon_type`, `damage`). private void OnPlayerHit(string hitBy, int level, string weaponType, int damage)

{
    GD.Print($"Hit by {hitBy} (level {level}) with weapon {weaponType} for {damage} damage.");
}

[/csharp] [/codeblocks]

func (Object) Disconnect

func (self Object) Disconnect(signal StringName, callable Callable)

Disconnects a [param signal] by name from a given [param callable]. If the connection does not exist, generates an error. Use [method is_connected] to make sure that the connection exists.

func (Object) Free

func (self Object) Free()

func (Object) Get

func (self Object) Get(ctx Lifetime, property StringName) Variant

Returns the Variant value of the given [param property]. If the [param property] does not exist, this method returns [code]null[/code]. [codeblocks] [gdscript] var node = Node2D.new() node.rotation = 1.5 var a = node.get("rotation") # a is 1.5 [/gdscript] [csharp] var node = new Node2D(); node.Rotation = 1.5f; var a = node.Get(Node2D.PropertyName.Rotation); // a is 1.5 [/csharp] [/codeblocks] [b]Note:[/b] In C#, [param property] must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the [code]PropertyName[/code] class to avoid allocating a new StringName on each call.

func (Object) GetClass

func (self Object) GetClass(ctx Lifetime) String

Returns the object's built-in class name, as a String. See also [method is_class]. [b]Note:[/b] This method ignores [code]class_name[/code] declarations. If this object's script has defined a [code]class_name[/code], the base, built-in class name is returned instead.

func (Object) GetIncomingConnections

func (self Object) GetIncomingConnections(ctx Lifetime) ArrayOf[Dictionary]

Returns an Array of signal connections received by this object. Each connection is represented as a Dictionary that contains three entries: - [code]signal[/code] is a reference to the Signal; - [code]callable[/code] is a reference to the Callable; - [code]flags[/code] is a combination of [enum ConnectFlags].

func (Object) GetIndexed

func (self Object) GetIndexed(ctx Lifetime, property_path NodePath) Variant

Gets the object's property indexed by the given [param property_path]. The path should be a NodePath relative to the current object and can use the colon character ([code]:[/code]) to access nested properties. [b]Examples:[/b] [code]"position:x"[/code] or [code]"material:next_pass:blend_mode"[/code]. [codeblocks] [gdscript] var node = Node2D.new() node.position = Vector2(5, -10) var a = node.get_indexed("position") # a is Vector2(5, -10) var b = node.get_indexed("position:y") # b is -10 [/gdscript] [csharp] var node = new Node2D(); node.Position = new Vector2(5, -10); var a = node.GetIndexed("position"); // a is Vector2(5, -10) var b = node.GetIndexed("position:y"); // b is -10 [/csharp] [/codeblocks] [b]Note:[/b] In C#, [param property_path] must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the [code]PropertyName[/code] class to avoid allocating a new StringName on each call. [b]Note:[/b] This method does not support actual paths to nodes in the [SceneTree], only sub-property paths. In the context of nodes, use [method Node.get_node_and_resource] instead.

func (Object) GetInstanceId

func (self Object) GetInstanceId() Int

Returns the object's unique instance ID. This ID can be saved in [EncodedObjectAsID], and can be used to retrieve this object instance with [method @GlobalScope.instance_from_id]. [b]Note:[/b] This ID is only useful during the current session. It won't correspond to a similar object if the ID is sent over a network, or loaded from a file at a later time.

func (Object) GetMeta

func (self Object) GetMeta(ctx Lifetime, name StringName, def Variant) Variant

Returns the object's metadata value for the given entry [param name]. If the entry does not exist, returns [param default]. If [param default] is [code]null[/code], an error is also generated. [b]Note:[/b] A metadata's name must be a valid identifier as per [method StringName.is_valid_identifier] method. [b]Note:[/b] Metadata that has a name starting with an underscore ([code]_[/code]) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.

func (Object) GetMetaList

func (self Object) GetMetaList(ctx Lifetime) ArrayOf[StringName]

Returns the object's metadata entry names as a PackedStringArray.

func (Object) GetMethodArgumentCount

func (self Object) GetMethodArgumentCount(method StringName) Int

Returns the number of arguments of the given [param method] by name. [b]Note:[/b] In C#, [param method] must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the [code]MethodName[/code] class to avoid allocating a new StringName on each call.

func (Object) GetMethodList

func (self Object) GetMethodList(ctx Lifetime) ArrayOf[Dictionary]

Returns this object's methods and their signatures as an Array of dictionaries. Each Dictionary contains the following entries: - [code]name[/code] is the name of the method, as a String; - [code]args[/code] is an Array of dictionaries representing the arguments; - [code]default_args[/code] is the default arguments as an Array of variants; - [code]flags[/code] is a combination of [enum MethodFlags]; - [code]id[/code] is the method's internal identifier [int]; - [code]return[/code] is the returned value, as a Dictionary; [b]Note:[/b] The dictionaries of [code]args[/code] and [code]return[/code] are formatted identically to the results of [method get_property_list], although not all entries are used.

func (Object) GetPropertyList

func (self Object) GetPropertyList(ctx Lifetime) ArrayOf[Dictionary]

Returns the object's property list as an Array of dictionaries. Each Dictionary contains the following entries: - [code]name[/code] is the property's name, as a String; - [code]class_name[/code] is an empty StringName, unless the property is [constant TYPE_OBJECT] and it inherits from a class; - [code]type[/code] is the property's type, as an [int] (see [enum Variant.Type]); - [code]hint[/code] is [i]how[/i] the property is meant to be edited (see [enum PropertyHint]); - [code]hint_string[/code] depends on the hint (see [enum PropertyHint]); - [code]usage[/code] is a combination of [enum PropertyUsageFlags]. [b]Note:[/b] In GDScript, all class members are treated as properties. In C# and GDExtension, it may be necessary to explicitly mark class members as Godot properties using decorators or attributes.

func (Object) GetScript

func (self Object) GetScript(ctx Lifetime) Variant

Returns the object's [Script] instance, or [code]null[/code] if no script is attached.

func (Object) GetSignalConnectionList

func (self Object) GetSignalConnectionList(ctx Lifetime, signal StringName) ArrayOf[Dictionary]

Returns an Array of connections for the given [param signal] name. Each connection is represented as a Dictionary that contains three entries: - [code skip-lint]signal[/code] is a reference to the Signal; - [code]callable[/code] is a reference to the connected Callable; - [code]flags[/code] is a combination of [enum ConnectFlags].

func (Object) GetSignalList

func (self Object) GetSignalList(ctx Lifetime) ArrayOf[Dictionary]

Returns the list of existing signals as an Array of dictionaries. [b]Note:[/b] Due of the implementation, each Dictionary is formatted very similarly to the returned values of [method get_method_list].

func (Object) HasMeta

func (self Object) HasMeta(name StringName) bool

Returns [code]true[/code] if a metadata entry is found with the given [param name]. See also [method get_meta], [method set_meta] and [method remove_meta]. [b]Note:[/b] A metadata's name must be a valid identifier as per [method StringName.is_valid_identifier] method. [b]Note:[/b] Metadata that has a name starting with an underscore ([code]_[/code]) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.

func (Object) HasMethod

func (self Object) HasMethod(method StringName) bool

Returns [code]true[/code] if the given [param method] name exists in the object. [b]Note:[/b] In C#, [param method] must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the [code]MethodName[/code] class to avoid allocating a new StringName on each call.

func (Object) HasSignal

func (self Object) HasSignal(signal StringName) bool

Returns [code]true[/code] if the given [param signal] name exists in the object. [b]Note:[/b] In C#, [param signal] must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the [code]SignalName[/code] class to avoid allocating a new StringName on each call.

func (Object) HasUserSignal

func (self Object) HasUserSignal(signal StringName) bool

Returns [code]true[/code] if the given user-defined [param signal] name exists. Only signals added with [method add_user_signal] are included. See also [method remove_user_signal].

func (Object) IsBlockingSignals

func (self Object) IsBlockingSignals() bool

Returns [code]true[/code] if the object is blocking its signals from being emitted. See [method set_block_signals].

func (Object) IsClass

func (self Object) IsClass(class String) bool

Returns [code]true[/code] if the object inherits from the given [param class]. See also [method get_class]. [codeblocks] [gdscript] var sprite2d = Sprite2D.new() sprite2d.is_class("Sprite2D") # Returns true sprite2d.is_class("Node") # Returns true sprite2d.is_class("Node3D") # Returns false [/gdscript] [csharp] var sprite2D = new Sprite2D(); sprite2D.IsClass("Sprite2D"); // Returns true sprite2D.IsClass("Node"); // Returns true sprite2D.IsClass("Node3D"); // Returns false [/csharp] [/codeblocks] [b]Note:[/b] This method ignores [code]class_name[/code] declarations in the object's script.

func (Object) IsConnected

func (self Object) IsConnected(signal StringName, callable Callable) bool

Returns [code]true[/code] if a connection exists between the given [param signal] name and [param callable]. [b]Note:[/b] In C#, [param signal] must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the [code]SignalName[/code] class to avoid allocating a new StringName on each call.

func (Object) IsQueuedForDeletion

func (self Object) IsQueuedForDeletion() bool

Returns [code]true[/code] if the [method Node.queue_free] method was called for the object.

func (Object) Notification

func (self Object) Notification(what Int, reversed bool)

Sends the given [param what] notification to all classes inherited by the object, triggering calls to [method _notification], starting from the highest ancestor (the Object class) and going down to the object's script. If [param reversed] is [code]true[/code], the call order is reversed. [codeblocks] [gdscript] var player = Node2D.new() player.set_script(load("res://player.gd"))

player.notification(NOTIFICATION_ENTER_TREE) # The call order is Object -> Node -> Node2D -> player.gd.

player.notification(NOTIFICATION_ENTER_TREE, true) # The call order is player.gd -> Node2D -> Node -> Object. [/gdscript] [csharp] var player = new Node2D(); player.SetScript(GD.Load("res://player.gd"));

player.Notification(NotificationEnterTree); // The call order is GodotObject -> Node -> Node2D -> player.gd.

player.Notification(NotificationEnterTree, true); // The call order is player.gd -> Node2D -> Node -> GodotObject. [/csharp] [/codeblocks]

func (Object) NotifyPropertyListChanged

func (self Object) NotifyPropertyListChanged()

Emits the [signal property_list_changed] signal. This is mainly used to refresh the editor, so that the Inspector and editor plugins are properly updated.

func (Object) PropertyCanRevert

func (self Object) PropertyCanRevert(property StringName) bool

Returns [code]true[/code] if the given [param property] has a custom default value. Use [method property_get_revert] to get the [param property]'s default value. [b]Note:[/b] This method is used by the Inspector dock to display a revert icon. The object must implement [method _property_can_revert] to customize the default value. If [method _property_can_revert] is not implemented, this method returns [code]false[/code].

func (Object) PropertyGetRevert

func (self Object) PropertyGetRevert(ctx Lifetime, property StringName) Variant

Returns the custom default value of the given [param property]. Use [method property_can_revert] to check if the [param property] has a custom default value. [b]Note:[/b] This method is used by the Inspector dock to display a revert icon. The object must implement [method _property_get_revert] to customize the default value. If [method _property_get_revert] is not implemented, this method returns [code]null[/code].

func (Object) RemoveMeta

func (self Object) RemoveMeta(name StringName)

Removes the given entry [param name] from the object's metadata. See also [method has_meta], [method get_meta] and [method set_meta]. [b]Note:[/b] A metadata's name must be a valid identifier as per [method StringName.is_valid_identifier] method. [b]Note:[/b] Metadata that has a name starting with an underscore ([code]_[/code]) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.

func (Object) RemoveUserSignal

func (self Object) RemoveUserSignal(signal StringName)

Removes the given user signal [param signal] from the object. See also [method add_user_signal] and [method has_user_signal].

func (Object) Set

func (self Object) Set(property StringName, value Variant)

Assigns [param value] to the given [param property]. If the property does not exist or the given [param value]'s type doesn't match, nothing happens. [codeblocks] [gdscript] var node = Node2D.new() node.set("global_scale", Vector2(8, 2.5)) print(node.global_scale) # Prints (8, 2.5) [/gdscript] [csharp] var node = new Node2D(); node.Set(Node2D.PropertyName.GlobalScale, new Vector2(8, 2.5)); GD.Print(node.GlobalScale); // Prints Vector2(8, 2.5) [/csharp] [/codeblocks] [b]Note:[/b] In C#, [param property] must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the [code]PropertyName[/code] class to avoid allocating a new StringName on each call.

func (Object) SetBlockSignals

func (self Object) SetBlockSignals(enable bool)

If set to [code]true[/code], the object becomes unable to emit signals. As such, [method emit_signal] and signal connections will not work, until it is set to [code]false[/code].

func (Object) SetDeferred

func (self Object) SetDeferred(property StringName, value Variant)

Assigns [param value] to the given [param property], at the end of the current frame. This is equivalent to calling [method set] through [method call_deferred]. [codeblocks] [gdscript] var node = Node2D.new() add_child(node)

node.rotation = 1.5 node.set_deferred("rotation", 3.0) print(node.rotation) # Prints 1.5

await get_tree().process_frame print(node.rotation) # Prints 3.0 [/gdscript] [csharp] var node = new Node2D(); node.Rotation = 1.5f; node.SetDeferred(Node2D.PropertyName.Rotation, 3f); GD.Print(node.Rotation); // Prints 1.5

await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame); GD.Print(node.Rotation); // Prints 3.0 [/csharp] [/codeblocks] [b]Note:[/b] In C#, [param property] must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the [code]PropertyName[/code] class to avoid allocating a new StringName on each call.

func (Object) SetIndexed

func (self Object) SetIndexed(property_path NodePath, value Variant)

Assigns a new [param value] to the property identified by the [param property_path]. The path should be a NodePath relative to this object, and can use the colon character ([code]:[/code]) to access nested properties. [codeblocks] [gdscript] var node = Node2D.new() node.set_indexed("position", Vector2(42, 0)) node.set_indexed("position:y", -10) print(node.position) # Prints (42, -10) [/gdscript] [csharp] var node = new Node2D(); node.SetIndexed("position", new Vector2(42, 0)); node.SetIndexed("position:y", -10); GD.Print(node.Position); // Prints (42, -10) [/csharp] [/codeblocks] [b]Note:[/b] In C#, [param property_path] must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the [code]PropertyName[/code] class to avoid allocating a new StringName on each call.

func (Object) SetMessageTranslation

func (self Object) SetMessageTranslation(enable bool)

If set to [code]true[/code], allows the object to translate messages with [method tr] and [method tr_n]. Enabled by default. See also [method can_translate_messages].

func (Object) SetMeta

func (self Object) SetMeta(name StringName, value Variant)

Adds or changes the entry [param name] inside the object's metadata. The metadata [param value] can be any Variant, although some types cannot be serialized correctly. If [param value] is [code]null[/code], the entry is removed. This is the equivalent of using [method remove_meta]. See also [method has_meta] and [method get_meta]. [b]Note:[/b] A metadata's name must be a valid identifier as per [method StringName.is_valid_identifier] method. [b]Note:[/b] Metadata that has a name starting with an underscore ([code]_[/code]) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.

func (*Object) SetPointer

func (o *Object) SetPointer(ptr Pointer)

func (Object) SetScript

func (self Object) SetScript(script Variant)

Attaches [param script] to the object, and instantiates it. As a result, the script's [method _init] is called. A [Script] is used to extend the object's functionality. If a script already exists, its instance is detached, and its property values and state are lost. Built-in property values are still kept.

func (Object) ToString

func (self Object) ToString(ctx Lifetime) String

Returns a String representing the object. Defaults to [code]"<ClassName#RID>"[/code]. Override [method _to_string] to customize the string representation of the object.

func (Object) Tr

func (self Object) Tr(ctx Lifetime, message StringName, context StringName) String

Translates a [param message], using the translation catalogs configured in the Project Settings. Further [param context] can be specified to help with the translation. Note that most [Control] nodes automatically translate their strings, so this method is mostly useful for formatted strings or custom drawn text. If [method can_translate_messages] is [code]false[/code], or no translation is available, this method returns the [param message] without changes. See [method set_message_translation]. For detailed examples, see [url=$DOCS_URL/tutorials/i18n/internationalizing_games.html]Internationalizing games[/url]. [b]Note:[/b] This method can't be used without an Object instance, as it requires the [method can_translate_messages] method. To translate strings in a static context, use [method TranslationServer.translate].

func (Object) TrN

func (self Object) TrN(ctx Lifetime, message StringName, plural_message StringName, n Int, context StringName) String

Translates a [param message] or [param plural_message], using the translation catalogs configured in the Project Settings. Further [param context] can be specified to help with the translation. If [method can_translate_messages] is [code]false[/code], or no translation is available, this method returns [param message] or [param plural_message], without changes. See [method set_message_translation]. The [param n] is the number, or amount, of the message's subject. It is used by the translation system to fetch the correct plural form for the current language. For detailed examples, see [url=$DOCS_URL/tutorials/i18n/localization_using_gettext.html]Localization using gettext[/url]. [b]Note:[/b] Negative and [float] numbers may not properly apply to some countable subjects. It's recommended to handle these cases with [method tr]. [b]Note:[/b] This method can't be used without an Object instance, as it requires the [method can_translate_messages] method. To translate strings in a static context, use [method TranslationServer.translate_plural].

func (Object) Virtual

func (self Object) Virtual(name string) reflect.Value

type ObjectConnectFlags

type ObjectConnectFlags int64

type ObjectID

type ObjectID uint64

type ObjectInterface

type ObjectInterface interface {
	OnCreate()
	Set(StringName, Variant) bool
	Get(StringName) (Variant, bool)
	GetPropertyList(Lifetime) []PropertyInfo
	PropertyCanRevert(StringName) bool
	PropertyGetRevert(Lifetime, StringName) (Variant, bool)
	ValidateProperty(StringName, *PropertyInfo) bool
	Notification(int32, bool)
	ToString() (String, bool)
	Reference()
	Unreference()
	CallVirtual(StringName, any, UnsafeArgs, UnsafeBack)
	GetRID() RID
	Free()
}

type Operator

type Operator int32
const (
	Equal Operator = iota
	NotEqual
	Less
	LessEqual
	Greater
	GreaterEqual
	Add
	Subtract
	Multiply
	Divide
	Negate
	Positive
	Module
	Power
	ShiftLeft
	ShiftRight
	BitAnd
	BitOr
	BitXor
	BitNegate
	LogicalAnd
	LogicalOr
	LogicalXor
	LogicalNegate
	In
)

type Orientation

type Orientation int64

type PackedByteArray

type PackedByteArray mmm.Pointer[API, PackedByteArray, [2]uintptr]

func (*PackedByteArray) Append

func (self *PackedByteArray) Append(value Int) bool

Appends an element at the end of the array (alias of [method push_back]).

func (*PackedByteArray) AppendArray

func (self *PackedByteArray) AppendArray(array PackedByteArray)

Appends a PackedByteArray at the end of this array.

func (*PackedByteArray) Bsearch

func (self *PackedByteArray) Bsearch(value Int, before bool) Int

Finds the index of an existing value (or the insertion index that maintains sorting order, if the value is not yet present in the array) using binary search. Optionally, a [param before] specifier can be passed. If [code]false[/code], the returned index comes after all existing entries of the value in the array. [b]Note:[/b] Calling [method bsearch] on an unsorted array results in unexpected behavior.

func (PackedByteArray) Bytes

func (p PackedByteArray) Bytes() []byte

Bytes returns a copy of the byte array as a byte slice.

func (PackedByteArray) Cap

func (p PackedByteArray) Cap() int

func (*PackedByteArray) Clear

func (self *PackedByteArray) Clear()

Clears the array. This is equivalent to using [method resize] with a size of [code]0[/code].

func (*PackedByteArray) Compress

func (self *PackedByteArray) Compress(ctx Lifetime, compression_mode Int) PackedByteArray

Returns a new PackedByteArray with the data compressed. Set the compression mode using one of [enum FileAccess.CompressionMode]'s constants.

func (*PackedByteArray) Count

func (self *PackedByteArray) Count(value Int) Int

Returns the number of times an element is in the array.

func (*PackedByteArray) DecodeDouble

func (self *PackedByteArray) DecodeDouble(byte_offset Int) Float

Decodes a 64-bit floating-point number from the bytes starting at [param byte_offset]. Fails if the byte count is insufficient. Returns [code]0.0[/code] if a valid number can't be decoded.

func (*PackedByteArray) DecodeFloat

func (self *PackedByteArray) DecodeFloat(byte_offset Int) Float

Decodes a 32-bit floating-point number from the bytes starting at [param byte_offset]. Fails if the byte count is insufficient. Returns [code]0.0[/code] if a valid number can't be decoded.

func (*PackedByteArray) DecodeHalf

func (self *PackedByteArray) DecodeHalf(byte_offset Int) Float

Decodes a 16-bit floating-point number from the bytes starting at [param byte_offset]. Fails if the byte count is insufficient. Returns [code]0.0[/code] if a valid number can't be decoded.

func (*PackedByteArray) DecodeS16

func (self *PackedByteArray) DecodeS16(byte_offset Int) Int

Decodes a 16-bit signed integer number from the bytes starting at [param byte_offset]. Fails if the byte count is insufficient. Returns [code]0[/code] if a valid number can't be decoded.

func (*PackedByteArray) DecodeS32

func (self *PackedByteArray) DecodeS32(byte_offset Int) Int

Decodes a 32-bit signed integer number from the bytes starting at [param byte_offset]. Fails if the byte count is insufficient. Returns [code]0[/code] if a valid number can't be decoded.

func (*PackedByteArray) DecodeS64

func (self *PackedByteArray) DecodeS64(byte_offset Int) Int

Decodes a 64-bit signed integer number from the bytes starting at [param byte_offset]. Fails if the byte count is insufficient. Returns [code]0[/code] if a valid number can't be decoded.

func (*PackedByteArray) DecodeS8

func (self *PackedByteArray) DecodeS8(byte_offset Int) Int

Decodes a 8-bit signed integer number from the bytes starting at [param byte_offset]. Fails if the byte count is insufficient. Returns [code]0[/code] if a valid number can't be decoded.

func (*PackedByteArray) DecodeU16

func (self *PackedByteArray) DecodeU16(byte_offset Int) Int

Decodes a 16-bit unsigned integer number from the bytes starting at [param byte_offset]. Fails if the byte count is insufficient. Returns [code]0[/code] if a valid number can't be decoded.

func (*PackedByteArray) DecodeU32

func (self *PackedByteArray) DecodeU32(byte_offset Int) Int

Decodes a 32-bit unsigned integer number from the bytes starting at [param byte_offset]. Fails if the byte count is insufficient. Returns [code]0[/code] if a valid number can't be decoded.

func (*PackedByteArray) DecodeU64

func (self *PackedByteArray) DecodeU64(byte_offset Int) Int

Decodes a 64-bit unsigned integer number from the bytes starting at [param byte_offset]. Fails if the byte count is insufficient. Returns [code]0[/code] if a valid number can't be decoded.

func (*PackedByteArray) DecodeU8

func (self *PackedByteArray) DecodeU8(byte_offset Int) Int

Decodes a 8-bit unsigned integer number from the bytes starting at [param byte_offset]. Fails if the byte count is insufficient. Returns [code]0[/code] if a valid number can't be decoded.

func (*PackedByteArray) DecodeVar

func (self *PackedByteArray) DecodeVar(ctx Lifetime, byte_offset Int, allow_objects bool) Variant

Decodes a Variant from the bytes starting at [param byte_offset]. Returns [code]null[/code] if a valid variant can't be decoded or the value is Object-derived and [param allow_objects] is [code]false[/code].

func (*PackedByteArray) DecodeVarSize

func (self *PackedByteArray) DecodeVarSize(byte_offset Int, allow_objects bool) Int

Decodes a size of a Variant from the bytes starting at [param byte_offset]. Requires at least 4 bytes of data starting at the offset, otherwise fails.

func (*PackedByteArray) Decompress

func (self *PackedByteArray) Decompress(ctx Lifetime, buffer_size Int, compression_mode Int) PackedByteArray

Returns a new PackedByteArray with the data decompressed. Set [param buffer_size] to the size of the uncompressed data. Set the compression mode using one of [enum FileAccess.CompressionMode]'s constants. [b]Note:[/b] Decompression is not guaranteed to work with data not compressed by Godot, for example if data compressed with the deflate compression mode lacks a checksum or header.

func (*PackedByteArray) DecompressDynamic

func (self *PackedByteArray) DecompressDynamic(ctx Lifetime, max_output_size Int, compression_mode Int) PackedByteArray

Returns a new PackedByteArray with the data decompressed. Set the compression mode using one of [enum FileAccess.CompressionMode]'s constants. [b]This method only accepts brotli, gzip, and deflate compression modes.[/b] This method is potentially slower than [method decompress], as it may have to re-allocate its output buffer multiple times while decompressing, whereas [method decompress] knows it's output buffer size from the beginning. GZIP has a maximal compression ratio of 1032:1, meaning it's very possible for a small compressed payload to decompress to a potentially very large output. To guard against this, you may provide a maximum size this function is allowed to allocate in bytes via [param max_output_size]. Passing -1 will allow for unbounded output. If any positive value is passed, and the decompression exceeds that amount in bytes, then an error will be returned. [b]Note:[/b] Decompression is not guaranteed to work with data not compressed by Godot, for example if data compressed with the deflate compression mode lacks a checksum or header.

func (*PackedByteArray) Duplicate

func (self *PackedByteArray) Duplicate(ctx Lifetime) PackedByteArray

Creates a copy of the array, and returns it.

func (*PackedByteArray) EncodeDouble

func (self *PackedByteArray) EncodeDouble(byte_offset Int, value Float)

Encodes a 64-bit floating-point number as bytes at the index of [param byte_offset] bytes. The array must have at least 8 bytes of allocated space, starting at the offset.

func (*PackedByteArray) EncodeFloat

func (self *PackedByteArray) EncodeFloat(byte_offset Int, value Float)

Encodes a 32-bit floating-point number as bytes at the index of [param byte_offset] bytes. The array must have at least 4 bytes of space, starting at the offset.

func (*PackedByteArray) EncodeHalf

func (self *PackedByteArray) EncodeHalf(byte_offset Int, value Float)

Encodes a 16-bit floating-point number as bytes at the index of [param byte_offset] bytes. The array must have at least 2 bytes of space, starting at the offset.

func (*PackedByteArray) EncodeS16

func (self *PackedByteArray) EncodeS16(byte_offset Int, value Int)

Encodes a 16-bit signed integer number as bytes at the index of [param byte_offset] bytes. The array must have at least 2 bytes of space, starting at the offset.

func (*PackedByteArray) EncodeS32

func (self *PackedByteArray) EncodeS32(byte_offset Int, value Int)

Encodes a 32-bit signed integer number as bytes at the index of [param byte_offset] bytes. The array must have at least 4 bytes of space, starting at the offset.

func (*PackedByteArray) EncodeS64

func (self *PackedByteArray) EncodeS64(byte_offset Int, value Int)

Encodes a 64-bit signed integer number as bytes at the index of [param byte_offset] bytes. The array must have at least 8 bytes of space, starting at the offset.

func (*PackedByteArray) EncodeS8

func (self *PackedByteArray) EncodeS8(byte_offset Int, value Int)

Encodes a 8-bit signed integer number (signed byte) at the index of [param byte_offset] bytes. The array must have at least 1 byte of space, starting at the offset.

func (*PackedByteArray) EncodeU16

func (self *PackedByteArray) EncodeU16(byte_offset Int, value Int)

Encodes a 16-bit unsigned integer number as bytes at the index of [param byte_offset] bytes. The array must have at least 2 bytes of space, starting at the offset.

func (*PackedByteArray) EncodeU32

func (self *PackedByteArray) EncodeU32(byte_offset Int, value Int)

Encodes a 32-bit unsigned integer number as bytes at the index of [param byte_offset] bytes. The array must have at least 4 bytes of space, starting at the offset.

func (*PackedByteArray) EncodeU64

func (self *PackedByteArray) EncodeU64(byte_offset Int, value Int)

Encodes a 64-bit unsigned integer number as bytes at the index of [param byte_offset] bytes. The array must have at least 8 bytes of space, starting at the offset.

func (*PackedByteArray) EncodeU8

func (self *PackedByteArray) EncodeU8(byte_offset Int, value Int)

Encodes a 8-bit unsigned integer number (byte) at the index of [param byte_offset] bytes. The array must have at least 1 byte of space, starting at the offset.

func (*PackedByteArray) EncodeVar

func (self *PackedByteArray) EncodeVar(byte_offset Int, value Variant, allow_objects bool) Int

Encodes a Variant at the index of [param byte_offset] bytes. A sufficient space must be allocated, depending on the encoded variant's size. If [param allow_objects] is [code]false[/code], Object-derived values are not permitted and will instead be serialized as ID-only.

func (*PackedByteArray) Fill

func (self *PackedByteArray) Fill(value Int)

Assigns the given value to all elements in the array. This can typically be used together with [method resize] to create an array with a given size and initialized elements.

func (*PackedByteArray) Find

func (self *PackedByteArray) Find(value Int, from Int) Int

Searches the array for a value and returns its index or [code]-1[/code] if not found. Optionally, the initial search index can be passed.

func (PackedByteArray) Free

func (p PackedByteArray) Free()

func (*PackedByteArray) GetStringFromAscii

func (self *PackedByteArray) GetStringFromAscii(ctx Lifetime) String

Converts ASCII/Latin-1 encoded array to String. Fast alternative to [method get_string_from_utf8] if the content is ASCII/Latin-1 only. Unlike the UTF-8 function this function maps every byte to a character in the array. Multibyte sequences will not be interpreted correctly. For parsing user input always use [method get_string_from_utf8]. This is the inverse of [method String.to_ascii_buffer].

func (*PackedByteArray) GetStringFromUtf16

func (self *PackedByteArray) GetStringFromUtf16(ctx Lifetime) String

Converts UTF-16 encoded array to String. If the BOM is missing, system endianness is assumed. Returns empty string if source array is not valid UTF-16 string. This is the inverse of [method String.to_utf16_buffer].

func (*PackedByteArray) GetStringFromUtf32

func (self *PackedByteArray) GetStringFromUtf32(ctx Lifetime) String

Converts UTF-32 encoded array to String. System endianness is assumed. Returns empty string if source array is not valid UTF-32 string. This is the inverse of [method String.to_utf32_buffer].

func (*PackedByteArray) GetStringFromUtf8

func (self *PackedByteArray) GetStringFromUtf8(ctx Lifetime) String

Converts UTF-8 encoded array to String. Slower than [method get_string_from_ascii] but supports UTF-8 encoded data. Use this function if you are unsure about the source of the data. For user input this function should always be preferred. Returns empty string if source array is not valid UTF-8 string. This is the inverse of [method String.to_utf8_buffer].

func (*PackedByteArray) GetStringFromWchar

func (self *PackedByteArray) GetStringFromWchar(ctx Lifetime) String

Converts wide character ([code]wchar_t[/code], UTF-16 on Windows, UTF-32 on other platforms) encoded array to String. Returns empty string if source array is not valid wide string. This is the inverse of [method String.to_wchar_buffer].

func (*PackedByteArray) Has

func (self *PackedByteArray) Has(value Int) bool

Returns [code]true[/code] if the array contains [param value].

func (*PackedByteArray) HasEncodedVar

func (self *PackedByteArray) HasEncodedVar(byte_offset Int, allow_objects bool) bool

Returns [code]true[/code] if a valid Variant value can be decoded at the [param byte_offset]. Returns [code]false[/code] otherwise or when the value is Object-derived and [param allow_objects] is [code]false[/code].

func (*PackedByteArray) HexEncode

func (self *PackedByteArray) HexEncode(ctx Lifetime) String

Returns a hexadecimal representation of this array as a String. [codeblocks] [gdscript] var array = PackedByteArray([11, 46, 255]) print(array.hex_encode()) # Prints: 0b2eff [/gdscript] [csharp] var array = new byte[] {11, 46, 255}; GD.Print(array.HexEncode()); // Prints: 0b2eff [/csharp] [/codeblocks]

func (PackedByteArray) Index

func (p PackedByteArray) Index(idx Int) byte

func (*PackedByteArray) Insert

func (self *PackedByteArray) Insert(at_index Int, value Int) Int

Inserts a new element at a given position in the array. The position must be valid, or at the end of the array ([code]idx == size()[/code]).

func (*PackedByteArray) IsEmpty

func (self *PackedByteArray) IsEmpty() bool

Returns [code]true[/code] if the array is empty.

func (PackedByteArray) Len

func (p PackedByteArray) Len() int

func (*PackedByteArray) PushBack

func (self *PackedByteArray) PushBack(value Int) bool

Appends an element at the end of the array.

func (*PackedByteArray) RemoveAt

func (self *PackedByteArray) RemoveAt(index Int)

Removes an element from the array by index.

func (*PackedByteArray) Resize

func (self *PackedByteArray) Resize(new_size Int) Int

Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.

func (*PackedByteArray) Reverse

func (self *PackedByteArray) Reverse()

Reverses the order of the elements in the array.

func (*PackedByteArray) Rfind

func (self *PackedByteArray) Rfind(value Int, from Int) Int

Searches the array in reverse order. Optionally, a start search index can be passed. If negative, the start index is considered relative to the end of the array.

func (*PackedByteArray) Set

func (self *PackedByteArray) Set(index Int, value Int)

Changes the byte at the given index.

func (PackedByteArray) SetIndex

func (p PackedByteArray) SetIndex(idx Int, value byte)

func (*PackedByteArray) Size

func (self *PackedByteArray) Size() Int

Returns the number of elements in the array.

func (*PackedByteArray) Slice

func (self *PackedByteArray) Slice(ctx Lifetime, begin Int, end Int) PackedByteArray

Returns the slice of the PackedByteArray, from [param begin] (inclusive) to [param end] (exclusive), as a new PackedByteArray. The absolute value of [param begin] and [param end] will be clamped to the array size, so the default value for [param end] makes it slice to the size of the array by default (i.e. [code]arr.slice(1)[/code] is a shorthand for [code]arr.slice(1, arr.size())[/code]). If either [param begin] or [param end] are negative, they will be relative to the end of the array (i.e. [code]arr.slice(0, -2)[/code] is a shorthand for [code]arr.slice(0, arr.size() - 2)[/code]).

func (*PackedByteArray) Sort

func (self *PackedByteArray) Sort()

Sorts the elements of the array in ascending order.

func (*PackedByteArray) ToFloat32Array

func (self *PackedByteArray) ToFloat32Array(ctx Lifetime) PackedFloat32Array

Returns a copy of the data converted to a PackedFloat32Array, where each block of 4 bytes has been converted to a 32-bit float (C++ [code skip-lint]float[/code]). The size of the input array must be a multiple of 4 (size of 32-bit float). The size of the new array will be [code]byte_array.size() / 4[/code]. If the original data can't be converted to 32-bit floats, the resulting data is undefined.

func (*PackedByteArray) ToFloat64Array

func (self *PackedByteArray) ToFloat64Array(ctx Lifetime) PackedFloat64Array

Returns a copy of the data converted to a PackedFloat64Array, where each block of 8 bytes has been converted to a 64-bit float (C++ [code]double[/code], Godot [float]). The size of the input array must be a multiple of 8 (size of 64-bit double). The size of the new array will be [code]byte_array.size() / 8[/code]. If the original data can't be converted to 64-bit floats, the resulting data is undefined.

func (*PackedByteArray) ToInt32Array

func (self *PackedByteArray) ToInt32Array(ctx Lifetime) PackedInt32Array

Returns a copy of the data converted to a PackedInt32Array, where each block of 4 bytes has been converted to a signed 32-bit integer (C++ [code]int32_t[/code]). The size of the input array must be a multiple of 4 (size of 32-bit integer). The size of the new array will be [code]byte_array.size() / 4[/code]. If the original data can't be converted to signed 32-bit integers, the resulting data is undefined.

func (*PackedByteArray) ToInt64Array

func (self *PackedByteArray) ToInt64Array(ctx Lifetime) PackedInt64Array

Returns a copy of the data converted to a PackedInt64Array, where each block of 8 bytes has been converted to a signed 64-bit integer (C++ [code]int64_t[/code], Godot [int]). The size of the input array must be a multiple of 8 (size of 64-bit integer). The size of the new array will be [code]byte_array.size() / 8[/code]. If the original data can't be converted to signed 64-bit integers, the resulting data is undefined.

func (PackedByteArray) UnsafePointer

func (p PackedByteArray) UnsafePointer() unsafe.Pointer

type PackedColorArray

type PackedColorArray mmm.Pointer[API, PackedColorArray, [2]uintptr]

func (*PackedColorArray) Append

func (self *PackedColorArray) Append(value Color) bool

Appends an element at the end of the array (alias of [method push_back]).

func (*PackedColorArray) AppendArray

func (self *PackedColorArray) AppendArray(array PackedColorArray)

Appends a PackedColorArray at the end of this array.

func (*PackedColorArray) Bsearch

func (self *PackedColorArray) Bsearch(value Color, before bool) Int

Finds the index of an existing value (or the insertion index that maintains sorting order, if the value is not yet present in the array) using binary search. Optionally, a [param before] specifier can be passed. If [code]false[/code], the returned index comes after all existing entries of the value in the array. [b]Note:[/b] Calling [method bsearch] on an unsorted array results in unexpected behavior.

func (PackedColorArray) Cap

func (p PackedColorArray) Cap() int

func (*PackedColorArray) Clear

func (self *PackedColorArray) Clear()

Clears the array. This is equivalent to using [method resize] with a size of [code]0[/code].

func (*PackedColorArray) Count

func (self *PackedColorArray) Count(value Color) Int

Returns the number of times an element is in the array.

func (*PackedColorArray) Duplicate

func (self *PackedColorArray) Duplicate(ctx Lifetime) PackedColorArray

Creates a copy of the array, and returns it.

func (*PackedColorArray) Fill

func (self *PackedColorArray) Fill(value Color)

Assigns the given value to all elements in the array. This can typically be used together with [method resize] to create an array with a given size and initialized elements.

func (*PackedColorArray) Find

func (self *PackedColorArray) Find(value Color, from Int) Int

Searches the array for a value and returns its index or [code]-1[/code] if not found. Optionally, the initial search index can be passed.

func (PackedColorArray) Free

func (p PackedColorArray) Free()

func (*PackedColorArray) Has

func (self *PackedColorArray) Has(value Color) bool

Returns [code]true[/code] if the array contains [param value].

func (PackedColorArray) Index

func (p PackedColorArray) Index(idx Int) Color

func (*PackedColorArray) Insert

func (self *PackedColorArray) Insert(at_index Int, value Color) Int

Inserts a new element at a given position in the array. The position must be valid, or at the end of the array ([code]idx == size()[/code]).

func (*PackedColorArray) IsEmpty

func (self *PackedColorArray) IsEmpty() bool

Returns [code]true[/code] if the array is empty.

func (PackedColorArray) Len

func (p PackedColorArray) Len() int

func (*PackedColorArray) PushBack

func (self *PackedColorArray) PushBack(value Color) bool

Appends a value to the array.

func (*PackedColorArray) RemoveAt

func (self *PackedColorArray) RemoveAt(index Int)

Removes an element from the array by index.

func (*PackedColorArray) Resize

func (self *PackedColorArray) Resize(new_size Int) Int

Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.

func (*PackedColorArray) Reverse

func (self *PackedColorArray) Reverse()

Reverses the order of the elements in the array.

func (*PackedColorArray) Rfind

func (self *PackedColorArray) Rfind(value Color, from Int) Int

Searches the array in reverse order. Optionally, a start search index can be passed. If negative, the start index is considered relative to the end of the array.

func (*PackedColorArray) Set

func (self *PackedColorArray) Set(index Int, value Color)

Changes the Color at the given index.

func (PackedColorArray) SetIndex

func (p PackedColorArray) SetIndex(idx Int, value Color)

func (*PackedColorArray) Size

func (self *PackedColorArray) Size() Int

Returns the number of elements in the array.

func (*PackedColorArray) Slice

func (self *PackedColorArray) Slice(ctx Lifetime, begin Int, end Int) PackedColorArray

Returns the slice of the PackedColorArray, from [param begin] (inclusive) to [param end] (exclusive), as a new PackedColorArray. The absolute value of [param begin] and [param end] will be clamped to the array size, so the default value for [param end] makes it slice to the size of the array by default (i.e. [code]arr.slice(1)[/code] is a shorthand for [code]arr.slice(1, arr.size())[/code]). If either [param begin] or [param end] are negative, they will be relative to the end of the array (i.e. [code]arr.slice(0, -2)[/code] is a shorthand for [code]arr.slice(0, arr.size() - 2)[/code]).

func (*PackedColorArray) Sort

func (self *PackedColorArray) Sort()

Sorts the elements of the array in ascending order.

func (*PackedColorArray) ToByteArray

func (self *PackedColorArray) ToByteArray(ctx Lifetime) PackedByteArray

Returns a PackedByteArray with each color encoded as bytes.

func (PackedColorArray) UnsafePointer

func (p PackedColorArray) UnsafePointer() unsafe.Pointer

type PackedFloat32Array

type PackedFloat32Array mmm.Pointer[API, PackedFloat32Array, [2]uintptr]

func (*PackedFloat32Array) Append

func (self *PackedFloat32Array) Append(value Float) bool

Appends an element at the end of the array (alias of [method push_back]).

func (*PackedFloat32Array) AppendArray

func (self *PackedFloat32Array) AppendArray(array PackedFloat32Array)

Appends a PackedFloat32Array at the end of this array.

func (*PackedFloat32Array) Bsearch

func (self *PackedFloat32Array) Bsearch(value Float, before bool) Int

Finds the index of an existing value (or the insertion index that maintains sorting order, if the value is not yet present in the array) using binary search. Optionally, a [param before] specifier can be passed. If [code]false[/code], the returned index comes after all existing entries of the value in the array. [b]Note:[/b] Calling [method bsearch] on an unsorted array results in unexpected behavior. [b]Note:[/b] [constant @GDScript.NAN] doesn't behave the same as other numbers. Therefore, the results from this method may not be accurate if NaNs are included.

func (PackedFloat32Array) Cap

func (p PackedFloat32Array) Cap() int

func (*PackedFloat32Array) Clear

func (self *PackedFloat32Array) Clear()

Clears the array. This is equivalent to using [method resize] with a size of [code]0[/code].

func (*PackedFloat32Array) Count

func (self *PackedFloat32Array) Count(value Float) Int

Returns the number of times an element is in the array. [b]Note:[/b] [constant @GDScript.NAN] doesn't behave the same as other numbers. Therefore, the results from this method may not be accurate if NaNs are included.

func (*PackedFloat32Array) Duplicate

func (self *PackedFloat32Array) Duplicate(ctx Lifetime) PackedFloat32Array

Creates a copy of the array, and returns it.

func (*PackedFloat32Array) Fill

func (self *PackedFloat32Array) Fill(value Float)

Assigns the given value to all elements in the array. This can typically be used together with [method resize] to create an array with a given size and initialized elements.

func (*PackedFloat32Array) Find

func (self *PackedFloat32Array) Find(value Float, from Int) Int

Searches the array for a value and returns its index or [code]-1[/code] if not found. Optionally, the initial search index can be passed. [b]Note:[/b] [constant @GDScript.NAN] doesn't behave the same as other numbers. Therefore, the results from this method may not be accurate if NaNs are included.

func (PackedFloat32Array) Free

func (p PackedFloat32Array) Free()

func (*PackedFloat32Array) Has

func (self *PackedFloat32Array) Has(value Float) bool

Returns [code]true[/code] if the array contains [param value]. [b]Note:[/b] [constant @GDScript.NAN] doesn't behave the same as other numbers. Therefore, the results from this method may not be accurate if NaNs are included.

func (PackedFloat32Array) Index

func (p PackedFloat32Array) Index(idx Int) float32

func (*PackedFloat32Array) Insert

func (self *PackedFloat32Array) Insert(at_index Int, value Float) Int

Inserts a new element at a given position in the array. The position must be valid, or at the end of the array ([code]idx == size()[/code]).

func (*PackedFloat32Array) IsEmpty

func (self *PackedFloat32Array) IsEmpty() bool

Returns [code]true[/code] if the array is empty.

func (PackedFloat32Array) Len

func (p PackedFloat32Array) Len() int

func (*PackedFloat32Array) PushBack

func (self *PackedFloat32Array) PushBack(value Float) bool

Appends an element at the end of the array.

func (*PackedFloat32Array) RemoveAt

func (self *PackedFloat32Array) RemoveAt(index Int)

Removes an element from the array by index.

func (*PackedFloat32Array) Resize

func (self *PackedFloat32Array) Resize(new_size Int) Int

Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.

func (*PackedFloat32Array) Reverse

func (self *PackedFloat32Array) Reverse()

Reverses the order of the elements in the array.

func (*PackedFloat32Array) Rfind

func (self *PackedFloat32Array) Rfind(value Float, from Int) Int

Searches the array in reverse order. Optionally, a start search index can be passed. If negative, the start index is considered relative to the end of the array. [b]Note:[/b] [constant @GDScript.NAN] doesn't behave the same as other numbers. Therefore, the results from this method may not be accurate if NaNs are included.

func (*PackedFloat32Array) Set

func (self *PackedFloat32Array) Set(index Int, value Float)

Changes the float at the given index.

func (PackedFloat32Array) SetIndex

func (p PackedFloat32Array) SetIndex(idx Int, value float32)

func (*PackedFloat32Array) Size

func (self *PackedFloat32Array) Size() Int

Returns the number of elements in the array.

func (*PackedFloat32Array) Slice

func (self *PackedFloat32Array) Slice(ctx Lifetime, begin Int, end Int) PackedFloat32Array

Returns the slice of the PackedFloat32Array, from [param begin] (inclusive) to [param end] (exclusive), as a new PackedFloat32Array. The absolute value of [param begin] and [param end] will be clamped to the array size, so the default value for [param end] makes it slice to the size of the array by default (i.e. [code]arr.slice(1)[/code] is a shorthand for [code]arr.slice(1, arr.size())[/code]). If either [param begin] or [param end] are negative, they will be relative to the end of the array (i.e. [code]arr.slice(0, -2)[/code] is a shorthand for [code]arr.slice(0, arr.size() - 2)[/code]).

func (*PackedFloat32Array) Sort

func (self *PackedFloat32Array) Sort()

Sorts the elements of the array in ascending order. [b]Note:[/b] [constant @GDScript.NAN] doesn't behave the same as other numbers. Therefore, the results from this method may not be accurate if NaNs are included.

func (*PackedFloat32Array) ToByteArray

func (self *PackedFloat32Array) ToByteArray(ctx Lifetime) PackedByteArray

Returns a copy of the data converted to a PackedByteArray, where each element have been encoded as 4 bytes. The size of the new array will be [code]float32_array.size() * 4[/code].

func (PackedFloat32Array) UnsafePointer

func (p PackedFloat32Array) UnsafePointer() unsafe.Pointer

type PackedFloat64Array

type PackedFloat64Array mmm.Pointer[API, PackedFloat64Array, [2]uintptr]

func (*PackedFloat64Array) Append

func (self *PackedFloat64Array) Append(value Float) bool

Appends an element at the end of the array (alias of [method push_back]).

func (*PackedFloat64Array) AppendArray

func (self *PackedFloat64Array) AppendArray(array PackedFloat64Array)

Appends a PackedFloat64Array at the end of this array.

func (*PackedFloat64Array) Bsearch

func (self *PackedFloat64Array) Bsearch(value Float, before bool) Int

Finds the index of an existing value (or the insertion index that maintains sorting order, if the value is not yet present in the array) using binary search. Optionally, a [param before] specifier can be passed. If [code]false[/code], the returned index comes after all existing entries of the value in the array. [b]Note:[/b] Calling [method bsearch] on an unsorted array results in unexpected behavior. [b]Note:[/b] [constant @GDScript.NAN] doesn't behave the same as other numbers. Therefore, the results from this method may not be accurate if NaNs are included.

func (PackedFloat64Array) Cap

func (p PackedFloat64Array) Cap() int

func (*PackedFloat64Array) Clear

func (self *PackedFloat64Array) Clear()

Clears the array. This is equivalent to using [method resize] with a size of [code]0[/code].

func (*PackedFloat64Array) Count

func (self *PackedFloat64Array) Count(value Float) Int

Returns the number of times an element is in the array. [b]Note:[/b] [constant @GDScript.NAN] doesn't behave the same as other numbers. Therefore, the results from this method may not be accurate if NaNs are included.

func (*PackedFloat64Array) Duplicate

func (self *PackedFloat64Array) Duplicate(ctx Lifetime) PackedFloat64Array

Creates a copy of the array, and returns it.

func (*PackedFloat64Array) Fill

func (self *PackedFloat64Array) Fill(value Float)

Assigns the given value to all elements in the array. This can typically be used together with [method resize] to create an array with a given size and initialized elements.

func (*PackedFloat64Array) Find

func (self *PackedFloat64Array) Find(value Float, from Int) Int

Searches the array for a value and returns its index or [code]-1[/code] if not found. Optionally, the initial search index can be passed. [b]Note:[/b] [constant @GDScript.NAN] doesn't behave the same as other numbers. Therefore, the results from this method may not be accurate if NaNs are included.

func (PackedFloat64Array) Free

func (p PackedFloat64Array) Free()

func (*PackedFloat64Array) Has

func (self *PackedFloat64Array) Has(value Float) bool

Returns [code]true[/code] if the array contains [param value]. [b]Note:[/b] [constant @GDScript.NAN] doesn't behave the same as other numbers. Therefore, the results from this method may not be accurate if NaNs are included.

func (PackedFloat64Array) Index

func (p PackedFloat64Array) Index(idx Int) float64

func (*PackedFloat64Array) Insert

func (self *PackedFloat64Array) Insert(at_index Int, value Float) Int

Inserts a new element at a given position in the array. The position must be valid, or at the end of the array ([code]idx == size()[/code]).

func (*PackedFloat64Array) IsEmpty

func (self *PackedFloat64Array) IsEmpty() bool

Returns [code]true[/code] if the array is empty.

func (PackedFloat64Array) Len

func (p PackedFloat64Array) Len() int

func (*PackedFloat64Array) PushBack

func (self *PackedFloat64Array) PushBack(value Float) bool

Appends an element at the end of the array.

func (*PackedFloat64Array) RemoveAt

func (self *PackedFloat64Array) RemoveAt(index Int)

Removes an element from the array by index.

func (*PackedFloat64Array) Resize

func (self *PackedFloat64Array) Resize(new_size Int) Int

Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.

func (*PackedFloat64Array) Reverse

func (self *PackedFloat64Array) Reverse()

Reverses the order of the elements in the array.

func (*PackedFloat64Array) Rfind

func (self *PackedFloat64Array) Rfind(value Float, from Int) Int

Searches the array in reverse order. Optionally, a start search index can be passed. If negative, the start index is considered relative to the end of the array. [b]Note:[/b] [constant @GDScript.NAN] doesn't behave the same as other numbers. Therefore, the results from this method may not be accurate if NaNs are included.

func (*PackedFloat64Array) Set

func (self *PackedFloat64Array) Set(index Int, value Float)

Changes the float at the given index.

func (PackedFloat64Array) SetIndex

func (p PackedFloat64Array) SetIndex(idx Int, value float64)

func (*PackedFloat64Array) Size

func (self *PackedFloat64Array) Size() Int

Returns the number of elements in the array.

func (*PackedFloat64Array) Slice

func (self *PackedFloat64Array) Slice(ctx Lifetime, begin Int, end Int) PackedFloat64Array

Returns the slice of the PackedFloat64Array, from [param begin] (inclusive) to [param end] (exclusive), as a new PackedFloat64Array. The absolute value of [param begin] and [param end] will be clamped to the array size, so the default value for [param end] makes it slice to the size of the array by default (i.e. [code]arr.slice(1)[/code] is a shorthand for [code]arr.slice(1, arr.size())[/code]). If either [param begin] or [param end] are negative, they will be relative to the end of the array (i.e. [code]arr.slice(0, -2)[/code] is a shorthand for [code]arr.slice(0, arr.size() - 2)[/code]).

func (*PackedFloat64Array) Sort

func (self *PackedFloat64Array) Sort()

Sorts the elements of the array in ascending order. [b]Note:[/b] [constant @GDScript.NAN] doesn't behave the same as other numbers. Therefore, the results from this method may not be accurate if NaNs are included.

func (*PackedFloat64Array) ToByteArray

func (self *PackedFloat64Array) ToByteArray(ctx Lifetime) PackedByteArray

Returns a copy of the data converted to a PackedByteArray, where each element have been encoded as 8 bytes. The size of the new array will be [code]float64_array.size() * 8[/code].

func (PackedFloat64Array) UnsafePointer

func (p PackedFloat64Array) UnsafePointer() unsafe.Pointer

type PackedFunctionsFor

type PackedFunctionsFor[T Packed, V any] struct {
	Index         func(T, Int) V
	SetIndex      func(T, Int, V)
	CopyAsSlice   func(T) []V
	UnsafePointer func(T) unsafe.Pointer
}

type PackedInt32Array

type PackedInt32Array mmm.Pointer[API, PackedInt32Array, [2]uintptr]

func (*PackedInt32Array) Append

func (self *PackedInt32Array) Append(value Int) bool

Appends an element at the end of the array (alias of [method push_back]).

func (*PackedInt32Array) AppendArray

func (self *PackedInt32Array) AppendArray(array PackedInt32Array)

Appends a PackedInt32Array at the end of this array.

func (*PackedInt32Array) Bsearch

func (self *PackedInt32Array) Bsearch(value Int, before bool) Int

Finds the index of an existing value (or the insertion index that maintains sorting order, if the value is not yet present in the array) using binary search. Optionally, a [param before] specifier can be passed. If [code]false[/code], the returned index comes after all existing entries of the value in the array. [b]Note:[/b] Calling [method bsearch] on an unsorted array results in unexpected behavior.

func (PackedInt32Array) Cap

func (p PackedInt32Array) Cap() int

func (*PackedInt32Array) Clear

func (self *PackedInt32Array) Clear()

Clears the array. This is equivalent to using [method resize] with a size of [code]0[/code].

func (*PackedInt32Array) Count

func (self *PackedInt32Array) Count(value Int) Int

Returns the number of times an element is in the array.

func (*PackedInt32Array) Duplicate

func (self *PackedInt32Array) Duplicate(ctx Lifetime) PackedInt32Array

Creates a copy of the array, and returns it.

func (*PackedInt32Array) Fill

func (self *PackedInt32Array) Fill(value Int)

Assigns the given value to all elements in the array. This can typically be used together with [method resize] to create an array with a given size and initialized elements.

func (*PackedInt32Array) Find

func (self *PackedInt32Array) Find(value Int, from Int) Int

Searches the array for a value and returns its index or [code]-1[/code] if not found. Optionally, the initial search index can be passed.

func (PackedInt32Array) Free

func (p PackedInt32Array) Free()

func (*PackedInt32Array) Has

func (self *PackedInt32Array) Has(value Int) bool

Returns [code]true[/code] if the array contains [param value].

func (PackedInt32Array) Index

func (p PackedInt32Array) Index(idx Int) int32

func (*PackedInt32Array) Insert

func (self *PackedInt32Array) Insert(at_index Int, value Int) Int

Inserts a new integer at a given position in the array. The position must be valid, or at the end of the array ([code]idx == size()[/code]).

func (*PackedInt32Array) IsEmpty

func (self *PackedInt32Array) IsEmpty() bool

Returns [code]true[/code] if the array is empty.

func (PackedInt32Array) Len

func (p PackedInt32Array) Len() int

func (*PackedInt32Array) PushBack

func (self *PackedInt32Array) PushBack(value Int) bool

Appends a value to the array.

func (*PackedInt32Array) RemoveAt

func (self *PackedInt32Array) RemoveAt(index Int)

Removes an element from the array by index.

func (*PackedInt32Array) Resize

func (self *PackedInt32Array) Resize(new_size Int) Int

Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.

func (*PackedInt32Array) Reverse

func (self *PackedInt32Array) Reverse()

Reverses the order of the elements in the array.

func (*PackedInt32Array) Rfind

func (self *PackedInt32Array) Rfind(value Int, from Int) Int

Searches the array in reverse order. Optionally, a start search index can be passed. If negative, the start index is considered relative to the end of the array.

func (*PackedInt32Array) Set

func (self *PackedInt32Array) Set(index Int, value Int)

Changes the integer at the given index.

func (PackedInt32Array) SetIndex

func (p PackedInt32Array) SetIndex(idx Int, value int32)

func (*PackedInt32Array) Size

func (self *PackedInt32Array) Size() Int

Returns the number of elements in the array.

func (*PackedInt32Array) Slice

func (self *PackedInt32Array) Slice(ctx Lifetime, begin Int, end Int) PackedInt32Array

Returns the slice of the PackedInt32Array, from [param begin] (inclusive) to [param end] (exclusive), as a new PackedInt32Array. The absolute value of [param begin] and [param end] will be clamped to the array size, so the default value for [param end] makes it slice to the size of the array by default (i.e. [code]arr.slice(1)[/code] is a shorthand for [code]arr.slice(1, arr.size())[/code]). If either [param begin] or [param end] are negative, they will be relative to the end of the array (i.e. [code]arr.slice(0, -2)[/code] is a shorthand for [code]arr.slice(0, arr.size() - 2)[/code]).

func (*PackedInt32Array) Sort

func (self *PackedInt32Array) Sort()

Sorts the elements of the array in ascending order.

func (*PackedInt32Array) ToByteArray

func (self *PackedInt32Array) ToByteArray(ctx Lifetime) PackedByteArray

Returns a copy of the data converted to a PackedByteArray, where each element have been encoded as 4 bytes. The size of the new array will be [code]int32_array.size() * 4[/code].

func (PackedInt32Array) UnsafePointer

func (p PackedInt32Array) UnsafePointer() unsafe.Pointer

type PackedInt64Array

type PackedInt64Array mmm.Pointer[API, PackedInt64Array, [2]uintptr]

func (*PackedInt64Array) Append

func (self *PackedInt64Array) Append(value Int) bool

Appends an element at the end of the array (alias of [method push_back]).

func (*PackedInt64Array) AppendArray

func (self *PackedInt64Array) AppendArray(array PackedInt64Array)

Appends a PackedInt64Array at the end of this array.

func (*PackedInt64Array) Bsearch

func (self *PackedInt64Array) Bsearch(value Int, before bool) Int

Finds the index of an existing value (or the insertion index that maintains sorting order, if the value is not yet present in the array) using binary search. Optionally, a [param before] specifier can be passed. If [code]false[/code], the returned index comes after all existing entries of the value in the array. [b]Note:[/b] Calling [method bsearch] on an unsorted array results in unexpected behavior.

func (PackedInt64Array) Cap

func (p PackedInt64Array) Cap() int

func (*PackedInt64Array) Clear

func (self *PackedInt64Array) Clear()

Clears the array. This is equivalent to using [method resize] with a size of [code]0[/code].

func (*PackedInt64Array) Count

func (self *PackedInt64Array) Count(value Int) Int

Returns the number of times an element is in the array.

func (*PackedInt64Array) Duplicate

func (self *PackedInt64Array) Duplicate(ctx Lifetime) PackedInt64Array

Creates a copy of the array, and returns it.

func (*PackedInt64Array) Fill

func (self *PackedInt64Array) Fill(value Int)

Assigns the given value to all elements in the array. This can typically be used together with [method resize] to create an array with a given size and initialized elements.

func (*PackedInt64Array) Find

func (self *PackedInt64Array) Find(value Int, from Int) Int

Searches the array for a value and returns its index or [code]-1[/code] if not found. Optionally, the initial search index can be passed.

func (PackedInt64Array) Free

func (p PackedInt64Array) Free()

func (*PackedInt64Array) Has

func (self *PackedInt64Array) Has(value Int) bool

Returns [code]true[/code] if the array contains [param value].

func (PackedInt64Array) Index

func (p PackedInt64Array) Index(idx Int) int64

func (*PackedInt64Array) Insert

func (self *PackedInt64Array) Insert(at_index Int, value Int) Int

Inserts a new integer at a given position in the array. The position must be valid, or at the end of the array ([code]idx == size()[/code]).

func (*PackedInt64Array) IsEmpty

func (self *PackedInt64Array) IsEmpty() bool

Returns [code]true[/code] if the array is empty.

func (PackedInt64Array) Len

func (p PackedInt64Array) Len() int

func (*PackedInt64Array) PushBack

func (self *PackedInt64Array) PushBack(value Int) bool

Appends a value to the array.

func (*PackedInt64Array) RemoveAt

func (self *PackedInt64Array) RemoveAt(index Int)

Removes an element from the array by index.

func (*PackedInt64Array) Resize

func (self *PackedInt64Array) Resize(new_size Int) Int

Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.

func (*PackedInt64Array) Reverse

func (self *PackedInt64Array) Reverse()

Reverses the order of the elements in the array.

func (*PackedInt64Array) Rfind

func (self *PackedInt64Array) Rfind(value Int, from Int) Int

Searches the array in reverse order. Optionally, a start search index can be passed. If negative, the start index is considered relative to the end of the array.

func (*PackedInt64Array) Set

func (self *PackedInt64Array) Set(index Int, value Int)

Changes the integer at the given index.

func (PackedInt64Array) SetIndex

func (p PackedInt64Array) SetIndex(idx Int, value int64)

func (*PackedInt64Array) Size

func (self *PackedInt64Array) Size() Int

Returns the number of elements in the array.

func (*PackedInt64Array) Slice

func (self *PackedInt64Array) Slice(ctx Lifetime, begin Int, end Int) PackedInt64Array

Returns the slice of the PackedInt64Array, from [param begin] (inclusive) to [param end] (exclusive), as a new PackedInt64Array. The absolute value of [param begin] and [param end] will be clamped to the array size, so the default value for [param end] makes it slice to the size of the array by default (i.e. [code]arr.slice(1)[/code] is a shorthand for [code]arr.slice(1, arr.size())[/code]). If either [param begin] or [param end] are negative, they will be relative to the end of the array (i.e. [code]arr.slice(0, -2)[/code] is a shorthand for [code]arr.slice(0, arr.size() - 2)[/code]).

func (*PackedInt64Array) Sort

func (self *PackedInt64Array) Sort()

Sorts the elements of the array in ascending order.

func (*PackedInt64Array) ToByteArray

func (self *PackedInt64Array) ToByteArray(ctx Lifetime) PackedByteArray

Returns a copy of the data converted to a PackedByteArray, where each element have been encoded as 8 bytes. The size of the new array will be [code]int64_array.size() * 8[/code].

func (PackedInt64Array) UnsafePointer

func (p PackedInt64Array) UnsafePointer() unsafe.Pointer

type PackedStringArray

type PackedStringArray mmm.Pointer[API, PackedStringArray, [2]uintptr]

func (*PackedStringArray) Append

func (self *PackedStringArray) Append(value String) bool

Appends an element at the end of the array (alias of [method push_back]).

func (*PackedStringArray) AppendArray

func (self *PackedStringArray) AppendArray(array PackedStringArray)

Appends a PackedStringArray at the end of this array.

func (PackedStringArray) AsSlice

func (p PackedStringArray) AsSlice(ctx Lifetime) []String

func (*PackedStringArray) Bsearch

func (self *PackedStringArray) Bsearch(value String, before bool) Int

Finds the index of an existing value (or the insertion index that maintains sorting order, if the value is not yet present in the array) using binary search. Optionally, a [param before] specifier can be passed. If [code]false[/code], the returned index comes after all existing entries of the value in the array. [b]Note:[/b] Calling [method bsearch] on an unsorted array results in unexpected behavior.

func (*PackedStringArray) Clear

func (self *PackedStringArray) Clear()

Clears the array. This is equivalent to using [method resize] with a size of [code]0[/code].

func (*PackedStringArray) Count

func (self *PackedStringArray) Count(value String) Int

Returns the number of times an element is in the array.

func (*PackedStringArray) Duplicate

func (self *PackedStringArray) Duplicate(ctx Lifetime) PackedStringArray

Creates a copy of the array, and returns it.

func (*PackedStringArray) Fill

func (self *PackedStringArray) Fill(value String)

Assigns the given value to all elements in the array. This can typically be used together with [method resize] to create an array with a given size and initialized elements.

func (*PackedStringArray) Find

func (self *PackedStringArray) Find(value String, from Int) Int

Searches the array for a value and returns its index or [code]-1[/code] if not found. Optionally, the initial search index can be passed.

func (PackedStringArray) Free

func (p PackedStringArray) Free()

func (*PackedStringArray) Has

func (self *PackedStringArray) Has(value String) bool

Returns [code]true[/code] if the array contains [param value].

func (PackedStringArray) Index

func (p PackedStringArray) Index(ctx Lifetime, idx Int) String

func (*PackedStringArray) Insert

func (self *PackedStringArray) Insert(at_index Int, value String) Int

Inserts a new element at a given position in the array. The position must be valid, or at the end of the array ([code]idx == size()[/code]).

func (*PackedStringArray) IsEmpty

func (self *PackedStringArray) IsEmpty() bool

Returns [code]true[/code] if the array is empty.

func (*PackedStringArray) PushBack

func (self *PackedStringArray) PushBack(value String) bool

Appends a string element at end of the array.

func (*PackedStringArray) RemoveAt

func (self *PackedStringArray) RemoveAt(index Int)

Removes an element from the array by index.

func (*PackedStringArray) Resize

func (self *PackedStringArray) Resize(new_size Int) Int

Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.

func (*PackedStringArray) Reverse

func (self *PackedStringArray) Reverse()

Reverses the order of the elements in the array.

func (*PackedStringArray) Rfind

func (self *PackedStringArray) Rfind(value String, from Int) Int

Searches the array in reverse order. Optionally, a start search index can be passed. If negative, the start index is considered relative to the end of the array.

func (*PackedStringArray) Set

func (self *PackedStringArray) Set(index Int, value String)

Changes the String at the given index.

func (PackedStringArray) SetIndex

func (p PackedStringArray) SetIndex(idx Int, value String)

func (*PackedStringArray) Size

func (self *PackedStringArray) Size() Int

Returns the number of elements in the array.

func (*PackedStringArray) Slice

func (self *PackedStringArray) Slice(ctx Lifetime, begin Int, end Int) PackedStringArray

Returns the slice of the PackedStringArray, from [param begin] (inclusive) to [param end] (exclusive), as a new PackedStringArray. The absolute value of [param begin] and [param end] will be clamped to the array size, so the default value for [param end] makes it slice to the size of the array by default (i.e. [code]arr.slice(1)[/code] is a shorthand for [code]arr.slice(1, arr.size())[/code]). If either [param begin] or [param end] are negative, they will be relative to the end of the array (i.e. [code]arr.slice(0, -2)[/code] is a shorthand for [code]arr.slice(0, arr.size() - 2)[/code]).

func (*PackedStringArray) Sort

func (self *PackedStringArray) Sort()

Sorts the elements of the array in ascending order.

func (PackedStringArray) String

func (p PackedStringArray) String() string

func (*PackedStringArray) ToByteArray

func (self *PackedStringArray) ToByteArray(ctx Lifetime) PackedByteArray

Returns a PackedByteArray with each string encoded as bytes.

type PackedVector2Array

type PackedVector2Array mmm.Pointer[API, PackedVector2Array, [2]uintptr]

func (*PackedVector2Array) Append

func (self *PackedVector2Array) Append(value Vector2) bool

Appends an element at the end of the array (alias of [method push_back]).

func (*PackedVector2Array) AppendArray

func (self *PackedVector2Array) AppendArray(array PackedVector2Array)

Appends a PackedVector2Array at the end of this array.

func (*PackedVector2Array) Bsearch

func (self *PackedVector2Array) Bsearch(value Vector2, before bool) Int

Finds the index of an existing value (or the insertion index that maintains sorting order, if the value is not yet present in the array) using binary search. Optionally, a [param before] specifier can be passed. If [code]false[/code], the returned index comes after all existing entries of the value in the array. [b]Note:[/b] Calling [method bsearch] on an unsorted array results in unexpected behavior. [b]Note:[/b] Vectors with [constant @GDScript.NAN] elements don't behave the same as other vectors. Therefore, the results from this method may not be accurate if NaNs are included.

func (PackedVector2Array) Cap

func (p PackedVector2Array) Cap() int

func (*PackedVector2Array) Clear

func (self *PackedVector2Array) Clear()

Clears the array. This is equivalent to using [method resize] with a size of [code]0[/code].

func (*PackedVector2Array) Count

func (self *PackedVector2Array) Count(value Vector2) Int

Returns the number of times an element is in the array. [b]Note:[/b] Vectors with [constant @GDScript.NAN] elements don't behave the same as other vectors. Therefore, the results from this method may not be accurate if NaNs are included.

func (*PackedVector2Array) Duplicate

func (self *PackedVector2Array) Duplicate(ctx Lifetime) PackedVector2Array

Creates a copy of the array, and returns it.

func (*PackedVector2Array) Fill

func (self *PackedVector2Array) Fill(value Vector2)

Assigns the given value to all elements in the array. This can typically be used together with [method resize] to create an array with a given size and initialized elements.

func (*PackedVector2Array) Find

func (self *PackedVector2Array) Find(value Vector2, from Int) Int

Searches the array for a value and returns its index or [code]-1[/code] if not found. Optionally, the initial search index can be passed. [b]Note:[/b] Vectors with [constant @GDScript.NAN] elements don't behave the same as other vectors. Therefore, the results from this method may not be accurate if NaNs are included.

func (PackedVector2Array) Free

func (p PackedVector2Array) Free()

func (*PackedVector2Array) Has

func (self *PackedVector2Array) Has(value Vector2) bool

Returns [code]true[/code] if the array contains [param value]. [b]Note:[/b] Vectors with [constant @GDScript.NAN] elements don't behave the same as other vectors. Therefore, the results from this method may not be accurate if NaNs are included.

func (PackedVector2Array) Index

func (p PackedVector2Array) Index(idx Int) Vector2

func (*PackedVector2Array) Insert

func (self *PackedVector2Array) Insert(at_index Int, value Vector2) Int

Inserts a new element at a given position in the array. The position must be valid, or at the end of the array ([code]idx == size()[/code]).

func (*PackedVector2Array) IsEmpty

func (self *PackedVector2Array) IsEmpty() bool

Returns [code]true[/code] if the array is empty.

func (PackedVector2Array) Len

func (p PackedVector2Array) Len() int

func (*PackedVector2Array) PushBack

func (self *PackedVector2Array) PushBack(value Vector2) bool

Inserts a Vector2 at the end.

func (*PackedVector2Array) RemoveAt

func (self *PackedVector2Array) RemoveAt(index Int)

Removes an element from the array by index.

func (*PackedVector2Array) Resize

func (self *PackedVector2Array) Resize(new_size Int) Int

Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.

func (*PackedVector2Array) Reverse

func (self *PackedVector2Array) Reverse()

Reverses the order of the elements in the array.

func (*PackedVector2Array) Rfind

func (self *PackedVector2Array) Rfind(value Vector2, from Int) Int

Searches the array in reverse order. Optionally, a start search index can be passed. If negative, the start index is considered relative to the end of the array. [b]Note:[/b] Vectors with [constant @GDScript.NAN] elements don't behave the same as other vectors. Therefore, the results from this method may not be accurate if NaNs are included.

func (*PackedVector2Array) Set

func (self *PackedVector2Array) Set(index Int, value Vector2)

Changes the Vector2 at the given index.

func (PackedVector2Array) SetIndex

func (p PackedVector2Array) SetIndex(idx Int, value Vector2)

func (*PackedVector2Array) Size

func (self *PackedVector2Array) Size() Int

Returns the number of elements in the array.

func (*PackedVector2Array) Slice

func (self *PackedVector2Array) Slice(ctx Lifetime, begin Int, end Int) PackedVector2Array

Returns the slice of the PackedVector2Array, from [param begin] (inclusive) to [param end] (exclusive), as a new PackedVector2Array. The absolute value of [param begin] and [param end] will be clamped to the array size, so the default value for [param end] makes it slice to the size of the array by default (i.e. [code]arr.slice(1)[/code] is a shorthand for [code]arr.slice(1, arr.size())[/code]). If either [param begin] or [param end] are negative, they will be relative to the end of the array (i.e. [code]arr.slice(0, -2)[/code] is a shorthand for [code]arr.slice(0, arr.size() - 2)[/code]).

func (*PackedVector2Array) Sort

func (self *PackedVector2Array) Sort()

Sorts the elements of the array in ascending order. [b]Note:[/b] Vectors with [constant @GDScript.NAN] elements don't behave the same as other vectors. Therefore, the results from this method may not be accurate if NaNs are included.

func (*PackedVector2Array) ToByteArray

func (self *PackedVector2Array) ToByteArray(ctx Lifetime) PackedByteArray

Returns a PackedByteArray with each vector encoded as bytes.

func (PackedVector2Array) UnsafePointer

func (p PackedVector2Array) UnsafePointer() unsafe.Pointer

type PackedVector3Array

type PackedVector3Array mmm.Pointer[API, PackedVector3Array, [2]uintptr]

func (*PackedVector3Array) Append

func (self *PackedVector3Array) Append(value Vector3) bool

Appends an element at the end of the array (alias of [method push_back]).

func (*PackedVector3Array) AppendArray

func (self *PackedVector3Array) AppendArray(array PackedVector3Array)

Appends a PackedVector3Array at the end of this array.

func (*PackedVector3Array) Bsearch

func (self *PackedVector3Array) Bsearch(value Vector3, before bool) Int

Finds the index of an existing value (or the insertion index that maintains sorting order, if the value is not yet present in the array) using binary search. Optionally, a [param before] specifier can be passed. If [code]false[/code], the returned index comes after all existing entries of the value in the array. [b]Note:[/b] Calling [method bsearch] on an unsorted array results in unexpected behavior. [b]Note:[/b] Vectors with [constant @GDScript.NAN] elements don't behave the same as other vectors. Therefore, the results from this method may not be accurate if NaNs are included.

func (PackedVector3Array) Cap

func (p PackedVector3Array) Cap() int

func (*PackedVector3Array) Clear

func (self *PackedVector3Array) Clear()

Clears the array. This is equivalent to using [method resize] with a size of [code]0[/code].

func (*PackedVector3Array) Count

func (self *PackedVector3Array) Count(value Vector3) Int

Returns the number of times an element is in the array. [b]Note:[/b] Vectors with [constant @GDScript.NAN] elements don't behave the same as other vectors. Therefore, the results from this method may not be accurate if NaNs are included.

func (*PackedVector3Array) Duplicate

func (self *PackedVector3Array) Duplicate(ctx Lifetime) PackedVector3Array

Creates a copy of the array, and returns it.

func (*PackedVector3Array) Fill

func (self *PackedVector3Array) Fill(value Vector3)

Assigns the given value to all elements in the array. This can typically be used together with [method resize] to create an array with a given size and initialized elements.

func (*PackedVector3Array) Find

func (self *PackedVector3Array) Find(value Vector3, from Int) Int

Searches the array for a value and returns its index or [code]-1[/code] if not found. Optionally, the initial search index can be passed. [b]Note:[/b] Vectors with [constant @GDScript.NAN] elements don't behave the same as other vectors. Therefore, the results from this method may not be accurate if NaNs are included.

func (PackedVector3Array) Free

func (p PackedVector3Array) Free()

func (*PackedVector3Array) Has

func (self *PackedVector3Array) Has(value Vector3) bool

Returns [code]true[/code] if the array contains [param value]. [b]Note:[/b] Vectors with [constant @GDScript.NAN] elements don't behave the same as other vectors. Therefore, the results from this method may not be accurate if NaNs are included.

func (PackedVector3Array) Index

func (p PackedVector3Array) Index(idx Int) Vector3

func (*PackedVector3Array) Insert

func (self *PackedVector3Array) Insert(at_index Int, value Vector3) Int

Inserts a new element at a given position in the array. The position must be valid, or at the end of the array ([code]idx == size()[/code]).

func (*PackedVector3Array) IsEmpty

func (self *PackedVector3Array) IsEmpty() bool

Returns [code]true[/code] if the array is empty.

func (PackedVector3Array) Len

func (p PackedVector3Array) Len() int

func (*PackedVector3Array) PushBack

func (self *PackedVector3Array) PushBack(value Vector3) bool

Inserts a Vector3 at the end.

func (*PackedVector3Array) RemoveAt

func (self *PackedVector3Array) RemoveAt(index Int)

Removes an element from the array by index.

func (*PackedVector3Array) Resize

func (self *PackedVector3Array) Resize(new_size Int) Int

Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.

func (*PackedVector3Array) Reverse

func (self *PackedVector3Array) Reverse()

Reverses the order of the elements in the array.

func (*PackedVector3Array) Rfind

func (self *PackedVector3Array) Rfind(value Vector3, from Int) Int

Searches the array in reverse order. Optionally, a start search index can be passed. If negative, the start index is considered relative to the end of the array. [b]Note:[/b] Vectors with [constant @GDScript.NAN] elements don't behave the same as other vectors. Therefore, the results from this method may not be accurate if NaNs are included.

func (*PackedVector3Array) Set

func (self *PackedVector3Array) Set(index Int, value Vector3)

Changes the Vector3 at the given index.

func (PackedVector3Array) SetIndex

func (p PackedVector3Array) SetIndex(idx Int, value Vector3)

func (*PackedVector3Array) Size

func (self *PackedVector3Array) Size() Int

Returns the number of elements in the array.

func (*PackedVector3Array) Slice

func (self *PackedVector3Array) Slice(ctx Lifetime, begin Int, end Int) PackedVector3Array

Returns the slice of the PackedVector3Array, from [param begin] (inclusive) to [param end] (exclusive), as a new PackedVector3Array. The absolute value of [param begin] and [param end] will be clamped to the array size, so the default value for [param end] makes it slice to the size of the array by default (i.e. [code]arr.slice(1)[/code] is a shorthand for [code]arr.slice(1, arr.size())[/code]). If either [param begin] or [param end] are negative, they will be relative to the end of the array (i.e. [code]arr.slice(0, -2)[/code] is a shorthand for [code]arr.slice(0, arr.size() - 2)[/code]).

func (*PackedVector3Array) Sort

func (self *PackedVector3Array) Sort()

Sorts the elements of the array in ascending order. [b]Note:[/b] Vectors with [constant @GDScript.NAN] elements don't behave the same as other vectors. Therefore, the results from this method may not be accurate if NaNs are included.

func (*PackedVector3Array) ToByteArray

func (self *PackedVector3Array) ToByteArray(ctx Lifetime) PackedByteArray

Returns a PackedByteArray with each vector encoded as bytes.

func (PackedVector3Array) UnsafePointer

func (p PackedVector3Array) UnsafePointer() unsafe.Pointer

type PackedVector4Array

type PackedVector4Array mmm.Pointer[API, PackedVector4Array, [2]uintptr]

func (*PackedVector4Array) Append

func (self *PackedVector4Array) Append(value Vector4) bool

Appends an element at the end of the array (alias of [method push_back]).

func (*PackedVector4Array) AppendArray

func (self *PackedVector4Array) AppendArray(array PackedVector4Array)

Appends a PackedVector4Array at the end of this array.

func (*PackedVector4Array) Bsearch

func (self *PackedVector4Array) Bsearch(value Vector4, before bool) Int

Finds the index of an existing value (or the insertion index that maintains sorting order, if the value is not yet present in the array) using binary search. Optionally, a [param before] specifier can be passed. If [code]false[/code], the returned index comes after all existing entries of the value in the array. [b]Note:[/b] Calling [method bsearch] on an unsorted array results in unexpected behavior. [b]Note:[/b] Vectors with [constant @GDScript.NAN] elements don't behave the same as other vectors. Therefore, the results from this method may not be accurate if NaNs are included.

func (PackedVector4Array) Cap

func (p PackedVector4Array) Cap() int

func (*PackedVector4Array) Clear

func (self *PackedVector4Array) Clear()

Clears the array. This is equivalent to using [method resize] with a size of [code]0[/code].

func (*PackedVector4Array) Count

func (self *PackedVector4Array) Count(value Vector4) Int

Returns the number of times an element is in the array. [b]Note:[/b] Vectors with [constant @GDScript.NAN] elements don't behave the same as other vectors. Therefore, the results from this method may not be accurate if NaNs are included.

func (*PackedVector4Array) Duplicate

func (self *PackedVector4Array) Duplicate(ctx Lifetime) PackedVector4Array

Creates a copy of the array, and returns it.

func (*PackedVector4Array) Fill

func (self *PackedVector4Array) Fill(value Vector4)

Assigns the given value to all elements in the array. This can typically be used together with [method resize] to create an array with a given size and initialized elements.

func (*PackedVector4Array) Find

func (self *PackedVector4Array) Find(value Vector4, from Int) Int

Searches the array for a value and returns its index or [code]-1[/code] if not found. Optionally, the initial search index can be passed. [b]Note:[/b] Vectors with [constant @GDScript.NAN] elements don't behave the same as other vectors. Therefore, the results from this method may not be accurate if NaNs are included.

func (PackedVector4Array) Free

func (p PackedVector4Array) Free()

func (*PackedVector4Array) Has

func (self *PackedVector4Array) Has(value Vector4) bool

Returns [code]true[/code] if the array contains [param value]. [b]Note:[/b] Vectors with [constant @GDScript.NAN] elements don't behave the same as other vectors. Therefore, the results from this method may not be accurate if NaNs are included.

func (PackedVector4Array) Index

func (p PackedVector4Array) Index(idx Int) Vector4

func (*PackedVector4Array) Insert

func (self *PackedVector4Array) Insert(at_index Int, value Vector4) Int

Inserts a new element at a given position in the array. The position must be valid, or at the end of the array ([code]idx == size()[/code]).

func (*PackedVector4Array) IsEmpty

func (self *PackedVector4Array) IsEmpty() bool

Returns [code]true[/code] if the array is empty.

func (PackedVector4Array) Len

func (p PackedVector4Array) Len() int

func (*PackedVector4Array) PushBack

func (self *PackedVector4Array) PushBack(value Vector4) bool

Inserts a Vector4 at the end.

func (*PackedVector4Array) RemoveAt

func (self *PackedVector4Array) RemoveAt(index Int)

Removes an element from the array by index.

func (*PackedVector4Array) Resize

func (self *PackedVector4Array) Resize(new_size Int) Int

Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size.

func (*PackedVector4Array) Reverse

func (self *PackedVector4Array) Reverse()

Reverses the order of the elements in the array.

func (*PackedVector4Array) Rfind

func (self *PackedVector4Array) Rfind(value Vector4, from Int) Int

Searches the array in reverse order. Optionally, a start search index can be passed. If negative, the start index is considered relative to the end of the array. [b]Note:[/b] Vectors with [constant @GDScript.NAN] elements don't behave the same as other vectors. Therefore, the results from this method may not be accurate if NaNs are included.

func (*PackedVector4Array) Set

func (self *PackedVector4Array) Set(index Int, value Vector4)

Changes the Vector4 at the given index.

func (PackedVector4Array) SetIndex

func (p PackedVector4Array) SetIndex(idx Int, value Vector4)

func (*PackedVector4Array) Size

func (self *PackedVector4Array) Size() Int

Returns the number of elements in the array.

func (*PackedVector4Array) Slice

func (self *PackedVector4Array) Slice(ctx Lifetime, begin Int, end Int) PackedVector4Array

Returns the slice of the PackedVector4Array, from [param begin] (inclusive) to [param end] (exclusive), as a new PackedVector4Array. The absolute value of [param begin] and [param end] will be clamped to the array size, so the default value for [param end] makes it slice to the size of the array by default (i.e. [code]arr.slice(1)[/code] is a shorthand for [code]arr.slice(1, arr.size())[/code]). If either [param begin] or [param end] are negative, they will be relative to the end of the array (i.e. [code]arr.slice(0, -2)[/code] is a shorthand for [code]arr.slice(0, arr.size() - 2)[/code]).

func (*PackedVector4Array) Sort

func (self *PackedVector4Array) Sort()

Sorts the elements of the array in ascending order. [b]Note:[/b] Vectors with [constant @GDScript.NAN] elements don't behave the same as other vectors. Therefore, the results from this method may not be accurate if NaNs are included.

func (*PackedVector4Array) ToByteArray

func (self *PackedVector4Array) ToByteArray(ctx Lifetime) PackedByteArray

Returns a PackedByteArray with each vector encoded as bytes.

func (PackedVector4Array) UnsafePointer

func (p PackedVector4Array) UnsafePointer() unsafe.Pointer

type PhysicsServer2DExtensionMotionResult

type PhysicsServer2DExtensionMotionResult struct {
	Travel, Remainder, CollisionPoint, CollisionNormal, ColliderVelocity Vector2
	CollisionDepth, CollisionSafeFraction, CollisionUnsafeFraction       float32
	CollisionLocalShape                                                  int32
	ColliderID                                                           uint64
	ColliderRID                                                          RID
	ColliderShape                                                        int32
}

type PhysicsServer2DExtensionRayResult

type PhysicsServer2DExtensionRayResult struct {
	Position, Normal Vector2
	RID              RID
	ColliderID       uint64
	Collider         *Object
	Shape            int32
}

type PhysicsServer2DExtensionShapeRestInfo

type PhysicsServer2DExtensionShapeRestInfo struct {
	Point, Normal, LinearVelocity Vector2
	RID                           RID
	ColliderID                    uint64
	Shape                         int32
}

type PhysicsServer2DExtensionShapeResult

type PhysicsServer2DExtensionShapeResult struct {
	RID        RID
	ColliderID uint64
	Collider   *Object
	Shape      int32
}

type PhysicsServer3DExtensionMotionCollision

type PhysicsServer3DExtensionMotionCollision struct {
	Position, Normal        Vector3
	ColliderVelocity        Vector3
	ColliderAngularVelocity Vector3
	Depth                   float32
	LocalShape              int32
	ColliderID              ObjectID
	Collider                RID
	ColliderShape           int32
}

type PhysicsServer3DExtensionMotionResult

type PhysicsServer3DExtensionMotionResult struct {
	Travel                  Vector3
	Remainder               Vector3
	CollisionDepth          float32
	CollisionSafeFraction   float32
	CollisionUnsafeFraction float32
	Collisions              [32]PhysicsServer3DExtensionMotionCollision
	CollisionCount          int32
}

type PhysicsServer3DExtensionRayResult

type PhysicsServer3DExtensionRayResult struct {
	Position, Normal Vector3
	RID              RID
	ColliderID       uint64
	Collider         uintptr
	Shape            int32
}

type PhysicsServer3DExtensionShapeRestInfo

type PhysicsServer3DExtensionShapeRestInfo struct {
	Point, Normal  Vector3
	RID            RID
	ColliderID     uint64
	Shape          int32
	LinearVelocity Vector3
}

type PhysicsServer3DExtensionShapeResult

type PhysicsServer3DExtensionShapeResult struct {
	RID        RID
	ColliderID uint64
	Collider   uintptr
	Shape      int32
}

type Plane

type Plane = xy.Plane

type Pointer

type Pointer mmm.Pointer[API, Pointer, [2]uintptr]

func PointerLifetimeBoundTo

func PointerLifetimeBoundTo(godot Lifetime, obj Object, ptr uintptr) Pointer

func PointerMustAssertInstanceID

func PointerMustAssertInstanceID(godot Lifetime, ptr uintptr) Pointer

func PointerWithOwnershipTransferredToGo

func PointerWithOwnershipTransferredToGo(godot Lifetime, ptr uintptr) Pointer

func (Pointer) AsObject

func (ptr Pointer) AsObject() Object

func (Pointer) AsPointer

func (ptr Pointer) AsPointer() Pointer

func (Pointer) Free

func (ptr Pointer) Free()

func (Pointer) Pin

func (ptr Pointer) Pin() Lifetime

func (Pointer) Pointer

func (ptr Pointer) Pointer() [2]uintptr

func (*Pointer) SetPointer

func (ptr *Pointer) SetPointer(to Pointer)

func (Pointer) Virtual

func (ptr Pointer) Virtual(string) reflect.Value

type PointerToClass

type PointerToClass interface {
	IsClass
	SetPointer(Pointer)
}

type Projection

type Projection = xy.Projection

type ProjectionPlanes

type ProjectionPlanes int64

type PropertyHint

type PropertyHint int64

type PropertyInfo

type PropertyInfo struct {
	Type       VariantType
	Name       StringName
	ClassName  StringName
	Hint       PropertyHint
	HintString String
	Usage      PropertyUsageFlags
}

type PropertyUsageFlags

type PropertyUsageFlags int64

type Quaternion

type Quaternion = xy.Quaternion

type RID

type RID uint64

type Rect2

type Rect2 = xy.Rect2

type Rect2i

type Rect2i = xy.Rect2i

type RefCounted

type RefCounted struct {
	// contains filtered or unexported fields
}

func (RefCounted) AsObject

func (self RefCounted) AsObject() Object

func (RefCounted) AsPointer

func (self RefCounted) AsPointer() Pointer

func (RefCounted) AsRefCounted

func (self RefCounted) AsRefCounted() RefCounted

func (RefCounted) GetReferenceCount

func (self RefCounted) GetReferenceCount() Int

Returns the current reference count.

func (RefCounted) InitRef

func (self RefCounted) InitRef() bool

Initializes the internal reference counter. Use this only if you really know what you are doing. Returns whether the initialization was successful.

func (RefCounted) Reference

func (self RefCounted) Reference() bool

Increments the internal reference counter. Use this only if you really know what you are doing. Returns [code]true[/code] if the increment was successful, [code]false[/code] otherwise.

func (*RefCounted) SetPointer

func (self *RefCounted) SetPointer(ptr Pointer)

func (RefCounted) Super

func (self RefCounted) Super() Object

func (RefCounted) Unreference

func (self RefCounted) Unreference() bool

Decrements the internal reference counter. Use this only if you really know what you are doing. Returns [code]true[/code] if the object should be freed after the decrement, [code]false[/code] otherwise.

func (RefCounted) Virtual

func (self RefCounted) Virtual(name string) reflect.Value

type Registrable

type Registrable interface {
	Register(Lifetime)
}

type ScriptLanguageExtensionProfilingInfo

type ScriptLanguageExtensionProfilingInfo struct {
	Signature    uintptr // StringName.Pointer()
	CallCount    uint64
	TotalTime    uint64
	SelfTime     uint64
	InternalTime uint64
}

type Side

type Side = xy.Side

type Signal

type Signal mmm.Pointer[API, Signal, [2]uintptr]

func (Signal) Connect

func (self Signal) Connect(callable Callable, flags Int) Int

Connects this signal to the specified [param callable]. Optional [param flags] can be also added to configure the connection's behavior (see [enum Object.ConnectFlags] constants). You can provide additional arguments to the connected [param callable] by using [method Callable.bind]. A signal can only be connected once to the same Callable. If the signal is already connected, returns [constant ERR_INVALID_PARAMETER] and pushes an error message, unless the signal is connected with [constant Object.CONNECT_REFERENCE_COUNTED]. To prevent this, use [method is_connected] first to check for existing connections. [codeblock] for button in $Buttons.get_children():

button.pressed.connect(_on_pressed.bind(button))

func _on_pressed(button):

print(button.name, " was pressed")

[/codeblock]

func (Signal) Disconnect

func (self Signal) Disconnect(callable Callable)

Disconnects this signal from the specified Callable. If the connection does not exist, generates an error. Use [method is_connected] to make sure that the connection exists.

func (Signal) Emit

func (self Signal) Emit(args ...Variant)

Emits this signal. All [Callable]s connected to this signal will be triggered. This method supports a variable number of arguments, so parameters can be passed as a comma separated list.

func (Signal) Free

func (s Signal) Free()

func (Signal) GetConnections

func (self Signal) GetConnections(ctx Lifetime) Array

Returns an Array of connections for this signal. Each connection is represented as a Dictionary that contains three entries: - [code]signal[/code] is a reference to this signal; - [code]callable[/code] is a reference to the connected Callable; - [code]flags[/code] is a combination of [enum Object.ConnectFlags].

func (Signal) GetName

func (self Signal) GetName(ctx Lifetime) StringName

Returns the name of this signal.

func (Signal) GetObject

func (self Signal) GetObject(ctx Lifetime) Object

Returns the object emitting this signal.

func (Signal) GetObjectId

func (self Signal) GetObjectId() Int

Returns the ID of the object emitting this signal (see [method Object.get_instance_id]).

func (Signal) IsConnected

func (self Signal) IsConnected(callable Callable) bool

Returns [code]true[/code] if the specified Callable is connected to this signal.

func (Signal) IsNull

func (self Signal) IsNull() bool

Returns [code]true[/code] if the signal's name does not exist in its object, or the object is not valid.

type Singleton

type Singleton interface {
	IsSingleton()
}

type String

type String mmm.Pointer[API, String, uintptr]

func (*String) Append

func (s *String) Append(ctx Lifetime, other String)

func (String) BeginsWith

func (self String) BeginsWith(text String) bool

Returns [code]true[/code] if the string begins with the given [param text]. See also [method ends_with].

func (String) Bigrams

func (self String) Bigrams(ctx Lifetime) PackedStringArray

Returns an array containing the bigrams (pairs of consecutive characters) of this string. [codeblock] print("Get up!".bigrams()) # Prints ["Ge", "et", "t ", " u", "up", "p!"] [/codeblock]

func (String) BinToInt

func (self String) BinToInt() Int

Converts the string representing a binary number into an [int]. The string may optionally be prefixed with [code]"0b"[/code], and an additional [code]-[/code] prefix for negative numbers. [codeblocks] [gdscript] print("101".bin_to_int()) # Prints 5 print("0b101".bin_to_int()) # Prints 5 print("-0b10".bin_to_int()) # Prints -2 [/gdscript] [csharp] GD.Print("101".BinToInt()); // Prints 5 GD.Print("0b101".BinToInt()); // Prints 5 GD.Print("-0b10".BinToInt()); // Prints -2 [/csharp] [/codeblocks]

func (String) CEscape

func (self String) CEscape(ctx Lifetime) String

Returns a copy of the string with special characters escaped using the C language standard.

func (String) CUnescape

func (self String) CUnescape(ctx Lifetime) String

Returns a copy of the string with escaped characters replaced by their meanings. Supported escape sequences are [code]\'[/code], [code]\"[/code], [code]\\[/code], [code]\a[/code], [code]\b[/code], [code]\f[/code], [code]\n[/code], [code]\r[/code], [code]\t[/code], [code]\v[/code]. [b]Note:[/b] Unlike the GDScript parser, this method doesn't support the [code]\uXXXX[/code] escape sequence.

func (String) Cap

func (s String) Cap() int

func (String) Capitalize

func (self String) Capitalize(ctx Lifetime) String

Changes the appearance of the string: replaces underscores ([code]_[/code]) with spaces, adds spaces before uppercase letters in the middle of a word, converts all letters to lowercase, then converts the first one and each one following a space to uppercase. [codeblocks] [gdscript] "move_local_x".capitalize() # Returns "Move Local X" "sceneFile_path".capitalize() # Returns "Scene File Path" "2D, FPS, PNG".capitalize() # Returns "2d, Fps, Png" [/gdscript] [csharp] "move_local_x".Capitalize(); // Returns "Move Local X" "sceneFile_path".Capitalize(); // Returns "Scene File Path" "2D, FPS, PNG".Capitalize(); // Returns "2d, Fps, Png" [/csharp] [/codeblocks]

func (String) CasecmpTo

func (self String) CasecmpTo(to String) Int

Performs a case-sensitive comparison to another string. Returns [code]-1[/code] if less than, [code]1[/code] if greater than, or [code]0[/code] if equal. "Less than" and "greater than" are determined by the [url=https://en.wikipedia.org/wiki/List_of_Unicode_characters]Unicode code points[/url] of each string, which roughly matches the alphabetical order. With different string lengths, returns [code]1[/code] if this string is longer than the [param to] string, or [code]-1[/code] if shorter. Note that the length of empty strings is [i]always[/i] [code]0[/code]. To get a [bool] result from a string comparison, use the [code]==[/code] operator instead. See also [method nocasecmp_to], [method filecasecmp_to], and [method naturalcasecmp_to].

func (String) Chr

func (self String) Chr(ctx Lifetime, char Int) String

Returns a single Unicode character from the decimal [param char]. You may use [url=https://unicodelookup.com/]unicodelookup.com[/url] or [url=https://www.unicode.org/charts/]unicode.org[/url] as points of reference. [codeblock] print(String.chr(65)) # Prints "A" print(String.chr(129302)) # Prints "🤖" (robot face emoji) [/codeblock]

func (String) Contains

func (self String) Contains(what String) bool

Returns [code]true[/code] if the string contains [param what]. In GDScript, this corresponds to the [code]in[/code] operator. [codeblocks] [gdscript] print("Node".contains("de")) # Prints true print("team".contains("I")) # Prints false print("I" in "team") # Prints false [/gdscript] [csharp] GD.Print("Node".Contains("de")); // Prints true GD.Print("team".Contains("I")); // Prints false [/csharp] [/codeblocks] If you need to know where [param what] is within the string, use [method find]. See also [method containsn].

func (String) Containsn

func (self String) Containsn(what String) bool

Returns [code]true[/code] if the string contains [param what], [b]ignoring case[/b]. If you need to know where [param what] is within the string, use [method findn]. See also [method contains].

func (String) Copy

func (s String) Copy(ctx Lifetime) String

Copy returns a copy of the string that is owned by the provided context.

func (String) Count

func (self String) Count(what String, from Int, to Int) Int

Returns the number of occurrences of the substring [param what] between [param from] and [param to] positions. If [param to] is 0, the search continues until the end of the string.

func (String) Countn

func (self String) Countn(what String, from Int, to Int) Int

Returns the number of occurrences of the substring [param what] between [param from] and [param to] positions, [b]ignoring case[/b]. If [param to] is 0, the search continues until the end of the string.

func (String) Dedent

func (self String) Dedent(ctx Lifetime) String

Returns a copy of the string with indentation (leading tabs and spaces) removed. See also [method indent] to add indentation.

func (String) EndsWith

func (self String) EndsWith(text String) bool

Returns [code]true[/code] if the string ends with the given [param text]. See also [method begins_with].

func (String) Erase

func (self String) Erase(ctx Lifetime, position Int, chars Int) String

Returns a string with [param chars] characters erased starting from [param position]. If [param chars] goes beyond the string's length given the specified [param position], fewer characters will be erased from the returned string. Returns an empty string if either [param position] or [param chars] is negative. Returns the original string unmodified if [param chars] is [code]0[/code].

func (String) FilecasecmpTo

func (self String) FilecasecmpTo(to String) Int

Like [method naturalcasecmp_to] but prioritizes strings that begin with periods ([code].[/code]) and underscores ([code]_[/code]) before any other character. Useful when sorting folders or file names. To get a [bool] result from a string comparison, use the [code]==[/code] operator instead. See also [method filenocasecmp_to], [method naturalcasecmp_to], and [method casecmp_to].

func (String) FilenocasecmpTo

func (self String) FilenocasecmpTo(to String) Int

Like [method naturalnocasecmp_to] but prioritizes strings that begin with periods ([code].[/code]) and underscores ([code]_[/code]) before any other character. Useful when sorting folders or file names. To get a [bool] result from a string comparison, use the [code]==[/code] operator instead. See also [method filecasecmp_to], [method naturalnocasecmp_to], and [method nocasecmp_to].

func (String) Find

func (self String) Find(what String, from Int) Int

Returns the index of the [b]first[/b] occurrence of [param what] in this string, or [code]-1[/code] if there are none. The search's start can be specified with [param from], continuing to the end of the string. [codeblocks] [gdscript] print("Team".find("I")) # Prints -1

print("Potato".find("t")) # Prints 2 print("Potato".find("t", 3)) # Prints 4 print("Potato".find("t", 5)) # Prints -1 [/gdscript] [csharp] GD.Print("Team".Find("I")); // Prints -1

GD.Print("Potato".Find("t")); // Prints 2 GD.Print("Potato".Find("t", 3)); // Prints 4 GD.Print("Potato".Find("t", 5)); // Prints -1 [/csharp] [/codeblocks] [b]Note:[/b] If you just want to know whether the string contains [param what], use [method contains]. In GDScript, you may also use the [code]in[/code] operator.

func (String) Findn

func (self String) Findn(what String, from Int) Int

Returns the index of the [b]first[/b] [b]case-insensitive[/b] occurrence of [param what] in this string, or [code]-1[/code] if there are none. The starting search index can be specified with [param from], continuing to the end of the string.

func (String) Format

func (self String) Format(ctx Lifetime, values Variant, placeholder String) String

Formats the string by replacing all occurrences of [param placeholder] with the elements of [param values]. [param values] can be a Dictionary or an Array. Any underscores in [param placeholder] will be replaced with the corresponding keys in advance. Array elements use their index as keys. [codeblock] # Prints "Waiting for Godot is a play by Samuel Beckett, and Godot Engine is named after it." var use_array_values = "Waiting for {0} is a play by {1}, and {0} Engine is named after it." print(use_array_values.format(["Godot", "Samuel Beckett"]))

# Prints "User 42 is Godot." print("User {id} is {name}.".format({"id": 42, "name": "Godot"})) [/codeblock] Some additional handling is performed when [param values] is an Array. If [param placeholder] does not contain an underscore, the elements of the [param values] array will be used to replace one occurrence of the placeholder in order; If an element of [param values] is another 2-element array, it'll be interpreted as a key-value pair. [codeblock] # Prints "User 42 is Godot." print("User {} is {}.".format([42, "Godot"], "{}")) print("User {id} is {name}.".format([["id", 42], ["name", "Godot"]])) [/codeblock] See also the [url=$DOCS_URL/tutorials/scripting/gdscript/gdscript_format_string.html]GDScript format string[/url] tutorial. [b]Note:[/b] The replacement of placeholders is not done all at once, instead each placeholder is replaced in the order they are passed, this means that if one of the replacement strings contains a key it will also be replaced. This can be very powerful, but can also cause unexpected results if you are not careful. If you do not need to perform replacement in the replacement strings, make sure your replacements do not contain placeholders to ensure reliable results. [codeblock] print("{0} {1}".format(["{1}", "x"])) # Prints "x x". print("{0} {1}".format(["x", "{0}"])) # Prints "x {0}". print("{foo} {bar}".format({"foo": "{bar}", "bar": "baz"})) # Prints "baz baz". print("{foo} {bar}".format({"bar": "baz", "foo": "{bar}"})) # Prints "{bar} baz". [/codeblock] [b]Note:[/b] In C#, it's recommended to [url=https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/interpolated]interpolate strings with "$"[/url], instead.

func (String) Free

func (s String) Free()

func (String) GetBaseDir

func (self String) GetBaseDir(ctx Lifetime) String

If the string is a valid file path, returns the base directory name. [codeblock] var dir_path = "/path/to/file.txt".get_base_dir() # dir_path is "/path/to" [/codeblock]

func (String) GetBasename

func (self String) GetBasename(ctx Lifetime) String

If the string is a valid file path, returns the full file path, without the extension. [codeblock] var base = "/path/to/file.txt".get_basename() # base is "/path/to/file" [/codeblock]

func (String) GetExtension

func (self String) GetExtension(ctx Lifetime) String

If the string is a valid file name or path, returns the file extension without the leading period ([code].[/code]). Otherwise, returns an empty string. [codeblock] var a = "/path/to/file.txt".get_extension() # a is "txt" var b = "cool.txt".get_extension() # b is "txt" var c = "cool.font.tres".get_extension() # c is "tres" var d = ".pack1".get_extension() # d is "pack1"

var e = "file.txt.".get_extension() # e is "" var f = "file.txt..".get_extension() # f is "" var g = "txt".get_extension() # g is "" var h = "".get_extension() # h is "" [/codeblock]

func (String) GetFile

func (self String) GetFile(ctx Lifetime) String

If the string is a valid file path, returns the file name, including the extension. [codeblock] var file = "/path/to/icon.png".get_file() # file is "icon.png" [/codeblock]

func (String) GetSlice

func (self String) GetSlice(ctx Lifetime, delimiter String, slice Int) String

Splits the string using a [param delimiter] and returns the substring at index [param slice]. Returns the original string if [param delimiter] does not occur in the string. Returns an empty string if the [param slice] does not exist. This is faster than [method split], if you only need one substring. [b]Example:[/b] [codeblock] print("i/am/example/hi".get_slice("/", 2)) # Prints "example" [/codeblock]

func (String) GetSliceCount

func (self String) GetSliceCount(delimiter String) Int

Returns the total number of slices when the string is split with the given [param delimiter] (see [method split]).

func (String) GetSlicec

func (self String) GetSlicec(ctx Lifetime, delimiter Int, slice Int) String

Splits the string using a Unicode character with code [param delimiter] and returns the substring at index [param slice]. Returns an empty string if the [param slice] does not exist. This is faster than [method split], if you only need one substring.

func (String) Hash

func (self String) Hash() Int

Returns the 32-bit hash value representing the string's contents. [b]Note:[/b] Strings with equal hash values are [i]not[/i] guaranteed to be the same, as a result of hash collisions. On the contrary, strings with different hash values are guaranteed to be different.

func (String) HexDecode

func (self String) HexDecode(ctx Lifetime) PackedByteArray

Decodes a hexadecimal string as a PackedByteArray. [codeblocks] [gdscript] var text = "hello world" var encoded = text.to_utf8_buffer().hex_encode() # outputs "68656c6c6f20776f726c64" print(buf.hex_decode().get_string_from_utf8()) [/gdscript] [csharp] var text = "hello world"; var encoded = text.ToUtf8Buffer().HexEncode(); // outputs "68656c6c6f20776f726c64" GD.Print(buf.HexDecode().GetStringFromUtf8()); [/csharp] [/codeblocks]

func (String) HexToInt

func (self String) HexToInt() Int

Converts the string representing a hexadecimal number into an [int]. The string may be optionally prefixed with [code]"0x"[/code], and an additional [code]-[/code] prefix for negative numbers. [codeblocks] [gdscript] print("0xff".hex_to_int()) # Prints 255 print("ab".hex_to_int()) # Prints 171 [/gdscript] [csharp] GD.Print("0xff".HexToInt()); // Prints 255 GD.Print("ab".HexToInt()); // Prints 171 [/csharp] [/codeblocks]

func (String) HumanizeSize

func (self String) HumanizeSize(ctx Lifetime, size Int) String

Converts [param size] which represents a number of bytes into a human-readable form. The result is in [url=https://en.wikipedia.org/wiki/Binary_prefix#IEC_prefixes]IEC prefix format[/url], which may end in either [code]"B"[/code], [code]"KiB"[/code], [code]"MiB"[/code], [code]"GiB"[/code], [code]"TiB"[/code], [code]"PiB"[/code], or [code]"EiB"[/code].

func (String) Indent

func (self String) Indent(ctx Lifetime, prefix String) String

Indents every line of the string with the given [param prefix]. Empty lines are not indented. See also [method dedent] to remove indentation. For example, the string can be indented with two tabulations using [code]"\t\t"[/code], or four spaces using [code]" "[/code].

func (String) Insert

func (self String) Insert(ctx Lifetime, position Int, what String) String

Inserts [param what] at the given [param position] in the string.

func (String) IsAbsolutePath

func (self String) IsAbsolutePath() bool

Returns [code]true[/code] if the string is a path to a file or directory, and its starting point is explicitly defined. This method is the opposite of [method is_relative_path]. This includes all paths starting with [code]"res://"[/code], [code]"user://"[/code], [code]"C:\"[/code], [code]"/"[/code], etc.

func (String) IsEmpty

func (self String) IsEmpty() bool

Returns [code]true[/code] if the string's length is [code]0[/code] ([code]""[/code]). See also [method length].

func (String) IsRelativePath

func (self String) IsRelativePath() bool

Returns [code]true[/code] if the string is a path, and its starting point is dependent on context. The path could begin from the current directory, or the current [Node] (if the string is derived from a NodePath), and may sometimes be prefixed with [code]"./"[/code]. This method is the opposite of [method is_absolute_path].

func (String) IsSubsequenceOf

func (self String) IsSubsequenceOf(text String) bool

Returns [code]true[/code] if all characters of this string can be found in [param text] in their original order. [codeblock] var text = "Wow, incredible!"

print("inedible".is_subsequence_of(text)) # Prints true print("Word!".is_subsequence_of(text)) # Prints true print("Window".is_subsequence_of(text)) # Prints false print("".is_subsequence_of(text)) # Prints true [/codeblock]

func (String) IsSubsequenceOfn

func (self String) IsSubsequenceOfn(text String) bool

Returns [code]true[/code] if all characters of this string can be found in [param text] in their original order, [b]ignoring case[/b].

func (String) IsValidFilename

func (self String) IsValidFilename() bool

Returns [code]true[/code] if this string does not contain characters that are not allowed in file names ([code]:[/code] [code]/[/code] [code]\[/code] [code]?[/code] [code]*[/code] [code]"[/code] [code]|[/code] [code]%[/code] [code]<[/code] [code]>[/code]).

func (String) IsValidFloat

func (self String) IsValidFloat() bool

Returns [code]true[/code] if this string represents a valid floating-point number. A valid float may contain only digits, one decimal point ([code].[/code]), and the exponent letter ([code]e[/code]). It may also be prefixed with a positive ([code]+[/code]) or negative ([code]-[/code]) sign. Any valid integer is also a valid float (see [method is_valid_int]). See also [method to_float]. [codeblock] print("1.7".is_valid_float()) # Prints true print("24".is_valid_float()) # Prints true print("7e3".is_valid_float()) # Prints true print("Hello".is_valid_float()) # Prints false [/codeblock]

func (String) IsValidHexNumber

func (self String) IsValidHexNumber(with_prefix bool) bool

Returns [code]true[/code] if this string is a valid hexadecimal number. A valid hexadecimal number only contains digits or letters [code]A[/code] to [code]F[/code] (either uppercase or lowercase), and may be prefixed with a positive ([code]+[/code]) or negative ([code]-[/code]) sign. If [param with_prefix] is [code]true[/code], the hexadecimal number needs to prefixed by [code]"0x"[/code] to be considered valid. [codeblock] print("A08E".is_valid_hex_number()) # Prints true print("-AbCdEf".is_valid_hex_number()) # Prints true print("2.5".is_valid_hex_number()) # Prints false

print("0xDEADC0DE".is_valid_hex_number(true)) # Prints true [/codeblock]

func (String) IsValidHtmlColor

func (self String) IsValidHtmlColor() bool

Returns [code]true[/code] if this string is a valid color in hexadecimal HTML notation. The string must be a hexadecimal value (see [method is_valid_hex_number]) of either 3, 4, 6 or 8 digits, and may be prefixed by a hash sign ([code]#[/code]). Other HTML notations for colors, such as names or [code]hsl()[/code], are not considered valid. See also [method Color.html].

func (String) IsValidIdentifier

func (self String) IsValidIdentifier() bool

Returns [code]true[/code] if this string is a valid identifier. A valid identifier may contain only letters, digits and underscores ([code]_[/code]), and the first character may not be a digit. [codeblock] print("node_2d".is_valid_identifier()) # Prints true print("TYPE_FLOAT".is_valid_identifier()) # Prints true print("1st_method".is_valid_identifier()) # Prints false print("MyMethod#2".is_valid_identifier()) # Prints false [/codeblock]

func (String) IsValidInt

func (self String) IsValidInt() bool

Returns [code]true[/code] if this string represents a valid integer. A valid integer only contains digits, and may be prefixed with a positive ([code]+[/code]) or negative ([code]-[/code]) sign. See also [method to_int]. [codeblock] print("7".is_valid_int()) # Prints true print("1.65".is_valid_int()) # Prints false print("Hi".is_valid_int()) # Prints false print("+3".is_valid_int()) # Prints true print("-12".is_valid_int()) # Prints true [/codeblock]

func (String) IsValidIpAddress

func (self String) IsValidIpAddress() bool

Returns [code]true[/code] if this string represents a well-formatted IPv4 or IPv6 address. This method considers [url=https://en.wikipedia.org/wiki/Reserved_IP_addresses]reserved IP addresses[/url] such as [code]"0.0.0.0"[/code] and [code]"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"[/code] as valid.

func (String) Join

func (self String) Join(ctx Lifetime, parts PackedStringArray) String

Returns the concatenation of [param parts]' elements, with each element separated by the string calling this method. This method is the opposite of [method split]. [b]Example:[/b] [codeblocks] [gdscript] var fruits = ["Apple", "Orange", "Pear", "Kiwi"]

print(", ".join(fruits)) # Prints "Apple, Orange, Pear, Kiwi" print("---".join(fruits)) # Prints "Apple---Orange---Pear---Kiwi" [/gdscript] [csharp] var fruits = new string[] {"Apple", "Orange", "Pear", "Kiwi"};

// In C#, this method is static. GD.Print(string.Join(", ", fruits)); // Prints "Apple, Orange, Pear, Kiwi" GD.Print(string.Join("---", fruits)); // Prints "Apple---Orange---Pear---Kiwi" [/csharp] [/codeblocks]

func (String) JsonEscape

func (self String) JsonEscape(ctx Lifetime) String

Returns a copy of the string with special characters escaped using the JSON standard. Because it closely matches the C standard, it is possible to use [method c_unescape] to unescape the string, if necessary.

func (String) Left

func (self String) Left(ctx Lifetime, length Int) String

Returns the first [param length] characters from the beginning of the string. If [param length] is negative, strips the last [param length] characters from the string's end. [codeblock] print("Hello World!".left(3)) # Prints "Hel" print("Hello World!".left(-4)) # Prints "Hello Wo" [/codeblock]

func (String) Len

func (s String) Len() int

func (String) Length

func (self String) Length() Int

Returns the number of characters in the string. Empty strings ([code]""[/code]) always return [code]0[/code]. See also [method is_empty].

func (String) Lpad

func (self String) Lpad(ctx Lifetime, min_length Int, character String) String

Formats the string to be at least [param min_length] long by adding [param character]s to the left of the string, if necessary. See also [method rpad].

func (String) Lstrip

func (self String) Lstrip(ctx Lifetime, chars String) String

Removes a set of characters defined in [param chars] from the string's beginning. See also [method rstrip]. [b]Note:[/b] [param chars] is not a prefix. Use [method trim_prefix] to remove a single prefix, rather than a set of characters.

func (String) Match

func (self String) Match(expr String) bool

Does a simple expression match (also called "glob" or "globbing"), where [code]*[/code] matches zero or more arbitrary characters and [code]?[/code] matches any single character except a period ([code].[/code]). An empty string or empty expression always evaluates to [code]false[/code].

func (String) Matchn

func (self String) Matchn(expr String) bool

Does a simple [b]case-insensitive[/b] expression match, where [code]*[/code] matches zero or more arbitrary characters and [code]?[/code] matches any single character except a period ([code].[/code]). An empty string or empty expression always evaluates to [code]false[/code].

func (String) Md5Buffer

func (self String) Md5Buffer(ctx Lifetime) PackedByteArray

Returns the [url=https://en.wikipedia.org/wiki/MD5]MD5 hash[/url] of the string as a PackedByteArray.

func (String) Md5Text

func (self String) Md5Text(ctx Lifetime) String

Returns the [url=https://en.wikipedia.org/wiki/MD5]MD5 hash[/url] of the string as another String.

func (String) NaturalcasecmpTo

func (self String) NaturalcasecmpTo(to String) Int

Performs a [b]case-sensitive[/b], [i]natural order[/i] comparison to another string. Returns [code]-1[/code] if less than, [code]1[/code] if greater than, or [code]0[/code] if equal. "Less than" or "greater than" are determined by the [url=https://en.wikipedia.org/wiki/List_of_Unicode_characters]Unicode code points[/url] of each string, which roughly matches the alphabetical order. When used for sorting, natural order comparison orders sequences of numbers by the combined value of each digit as is often expected, instead of the single digit's value. A sorted sequence of numbered strings will be [code]["1", "2", "3", ...][/code], not [code]["1", "10", "2", "3", ...][/code]. With different string lengths, returns [code]1[/code] if this string is longer than the [param to] string, or [code]-1[/code] if shorter. Note that the length of empty strings is [i]always[/i] [code]0[/code]. To get a [bool] result from a string comparison, use the [code]==[/code] operator instead. See also [method naturalnocasecmp_to], [method filecasecmp_to], and [method nocasecmp_to].

func (String) NaturalnocasecmpTo

func (self String) NaturalnocasecmpTo(to String) Int

Performs a [b]case-insensitive[/b], [i]natural order[/i] comparison to another string. Returns [code]-1[/code] if less than, [code]1[/code] if greater than, or [code]0[/code] if equal. "Less than" or "greater than" are determined by the [url=https://en.wikipedia.org/wiki/List_of_Unicode_characters]Unicode code points[/url] of each string, which roughly matches the alphabetical order. Internally, lowercase characters are converted to uppercase for the comparison. When used for sorting, natural order comparison orders sequences of numbers by the combined value of each digit as is often expected, instead of the single digit's value. A sorted sequence of numbered strings will be [code]["1", "2", "3", ...][/code], not [code]["1", "10", "2", "3", ...][/code]. With different string lengths, returns [code]1[/code] if this string is longer than the [param to] string, or [code]-1[/code] if shorter. Note that the length of empty strings is [i]always[/i] [code]0[/code]. To get a [bool] result from a string comparison, use the [code]==[/code] operator instead. See also [method naturalcasecmp_to], [method filenocasecmp_to], and [method casecmp_to].

func (String) NocasecmpTo

func (self String) NocasecmpTo(to String) Int

Performs a [b]case-insensitive[/b] comparison to another string. Returns [code]-1[/code] if less than, [code]1[/code] if greater than, or [code]0[/code] if equal. "Less than" or "greater than" are determined by the [url=https://en.wikipedia.org/wiki/List_of_Unicode_characters]Unicode code points[/url] of each string, which roughly matches the alphabetical order. Internally, lowercase characters are converted to uppercase for the comparison. With different string lengths, returns [code]1[/code] if this string is longer than the [param to] string, or [code]-1[/code] if shorter. Note that the length of empty strings is [i]always[/i] [code]0[/code]. To get a [bool] result from a string comparison, use the [code]==[/code] operator instead. See also [method casecmp_to], [method filenocasecmp_to], and [method naturalnocasecmp_to].

func (String) NodePath

func (s String) NodePath(ctx Lifetime) NodePath

func (String) Num

func (self String) Num(ctx Lifetime, number Float, decimals Int) String

Converts a [float] to a string representation of a decimal number, with the number of decimal places specified in [param decimals]. If [param decimals] is [code]-1[/code] as by default, the string representation may only have up to 14 significant digits, with digits before the decimal point having priority over digits after. Trailing zeros are not included in the string. The last digit is rounded, not truncated. [b]Example:[/b] [codeblock] String.num(3.141593) # Returns "3.141593" String.num(3.141593, 3) # Returns "3.142" String.num(3.14159300) # Returns "3.141593"

# Here, the last digit will be rounded up, # which reduces the total digit count, since trailing zeros are removed: String.num(42.129999, 5) # Returns "42.13"

# If `decimals` is not specified, the maximum number of significant digits is 14: String.num(-0.0000012345432123454321) # Returns "-0.00000123454321" String.num(-10000.0000012345432123454321) # Returns "-10000.0000012345" [/codeblock]

func (String) NumInt64

func (self String) NumInt64(ctx Lifetime, number Int, base Int, capitalize_hex bool) String

Converts the given [param number] to a string representation, with the given [param base]. By default, [param base] is set to decimal ([code]10[/code]). Other common bases in programming include binary ([code]2[/code]), [url=https://en.wikipedia.org/wiki/Octal]octal[/url] ([code]8[/code]), hexadecimal ([code]16[/code]). If [param capitalize_hex] is [code]true[/code], digits higher than 9 are represented in uppercase.

func (String) NumScientific

func (self String) NumScientific(ctx Lifetime, number Float) String

Converts the given [param number] to a string representation, in scientific notation. [codeblocks] [gdscript] var n = -5.2e8 print(n) # Prints -520000000 print(String.num_scientific(n)) # Prints -5.2e+08 [/gdscript] [csharp] // This method is not implemented in C#. // Use `string.ToString()` with "e" to achieve similar results. var n = -5.2e8f; GD.Print(n); // Prints -520000000 GD.Print(n.ToString("e1")); // Prints -5.2e+008 [/csharp] [/codeblocks] [b]Note:[/b] In C#, this method is not implemented. To achieve similar results, see C#'s [url=https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings]Standard numeric format strings[/url]

func (String) NumUint64

func (self String) NumUint64(ctx Lifetime, number Int, base Int, capitalize_hex bool) String

Converts the given unsigned [int] to a string representation, with the given [param base]. By default, [param base] is set to decimal ([code]10[/code]). Other common bases in programming include binary ([code]2[/code]), [url=https://en.wikipedia.org/wiki/Octal]octal[/url] ([code]8[/code]), hexadecimal ([code]16[/code]). If [param capitalize_hex] is [code]true[/code], digits higher than 9 are represented in uppercase.

func (String) PadDecimals

func (self String) PadDecimals(ctx Lifetime, digits Int) String

Formats the string representing a number to have an exact number of [param digits] [i]after[/i] the decimal point.

func (String) PadZeros

func (self String) PadZeros(ctx Lifetime, digits Int) String

Formats the string representing a number to have an exact number of [param digits] [i]before[/i] the decimal point.

func (String) PathJoin

func (self String) PathJoin(ctx Lifetime, file String) String

Concatenates [param file] at the end of the string as a subpath, adding [code]/[/code] if necessary. [b]Example:[/b] [code]"this/is".path_join("path") == "this/is/path"[/code].

func (String) Repeat

func (self String) Repeat(ctx Lifetime, count Int) String

Repeats this string a number of times. [param count] needs to be greater than [code]0[/code]. Otherwise, returns an empty string.

func (String) Replace

func (self String) Replace(ctx Lifetime, what String, forwhat String) String

Replaces all occurrences of [param what] inside the string with the given [param forwhat].

func (String) Replacen

func (self String) Replacen(ctx Lifetime, what String, forwhat String) String

Replaces all [b]case-insensitive[/b] occurrences of [param what] inside the string with the given [param forwhat].

func (String) Reverse

func (self String) Reverse(ctx Lifetime) String

Returns the copy of this string in reverse order. This operation works on unicode codepoints, rather than sequences of codepoints, and may break things like compound letters or emojis.

func (String) Rfind

func (self String) Rfind(what String, from Int) Int

Returns the index of the [b]last[/b] occurrence of [param what] in this string, or [code]-1[/code] if there are none. The search's start can be specified with [param from], continuing to the beginning of the string. This method is the reverse of [method find].

func (String) Rfindn

func (self String) Rfindn(what String, from Int) Int

Returns the index of the [b]last[/b] [b]case-insensitive[/b] occurrence of [param what] in this string, or [code]-1[/code] if there are none. The starting search index can be specified with [param from], continuing to the beginning of the string. This method is the reverse of [method findn].

func (String) Right

func (self String) Right(ctx Lifetime, length Int) String

Returns the last [param length] characters from the end of the string. If [param length] is negative, strips the first [param length] characters from the string's beginning. [codeblock] print("Hello World!".right(3)) # Prints "ld!" print("Hello World!".right(-4)) # Prints "o World!" [/codeblock]

func (String) Rpad

func (self String) Rpad(ctx Lifetime, min_length Int, character String) String

Formats the string to be at least [param min_length] long, by adding [param character]s to the right of the string, if necessary. See also [method lpad].

func (String) Rsplit

func (self String) Rsplit(ctx Lifetime, delimiter String, allow_empty bool, maxsplit Int) PackedStringArray

Splits the string using a [param delimiter] and returns an array of the substrings, starting from the end of the string. The splits in the returned array appear in the same order as the original string. If [param delimiter] is an empty string, each substring will be a single character. If [param allow_empty] is [code]false[/code], empty strings between adjacent delimiters are excluded from the array. If [param maxsplit] is greater than [code]0[/code], the number of splits may not exceed [param maxsplit]. By default, the entire string is split, which is mostly identical to [method split]. [b]Example:[/b] [codeblocks] [gdscript] var some_string = "One,Two,Three,Four" var some_array = some_string.rsplit(",", true, 1)

print(some_array.size()) # Prints 2 print(some_array[0]) # Prints "One,Two,Three" print(some_array[1]) # Prints "Four" [/gdscript] [csharp] // In C#, there is no String.RSplit() method. [/csharp] [/codeblocks]

func (String) Rstrip

func (self String) Rstrip(ctx Lifetime, chars String) String

Removes a set of characters defined in [param chars] from the string's end. See also [method lstrip]. [b]Note:[/b] [param chars] is not a suffix. Use [method trim_suffix] to remove a single suffix, rather than a set of characters.

func (String) Sha1Buffer

func (self String) Sha1Buffer(ctx Lifetime) PackedByteArray

Returns the [url=https://en.wikipedia.org/wiki/SHA-1]SHA-1[/url] hash of the string as a PackedByteArray.

func (String) Sha1Text

func (self String) Sha1Text(ctx Lifetime) String

Returns the [url=https://en.wikipedia.org/wiki/SHA-1]SHA-1[/url] hash of the string as another String.

func (String) Sha256Buffer

func (self String) Sha256Buffer(ctx Lifetime) PackedByteArray

Returns the [url=https://en.wikipedia.org/wiki/SHA-2]SHA-256[/url] hash of the string as a PackedByteArray.

func (String) Sha256Text

func (self String) Sha256Text(ctx Lifetime) String

Returns the [url=https://en.wikipedia.org/wiki/SHA-2]SHA-256[/url] hash of the string as another String.

func (String) Similarity

func (self String) Similarity(text String) Float

Returns the similarity index ([url=https://en.wikipedia.org/wiki/S%C3%B8rensen%E2%80%93Dice_coefficient]Sorensen-Dice coefficient[/url]) of this string compared to another. A result of [code]1.0[/code] means totally similar, while [code]0.0[/code] means totally dissimilar. [codeblock] print("ABC123".similarity("ABC123")) # Prints 1.0 print("ABC123".similarity("XYZ456")) # Prints 0.0 print("ABC123".similarity("123ABC")) # Prints 0.8 print("ABC123".similarity("abc123")) # Prints 0.4 [/codeblock]

func (String) SimplifyPath

func (self String) SimplifyPath(ctx Lifetime) String

If the string is a valid file path, converts the string into a canonical path. This is the shortest possible path, without [code]"./"[/code], and all the unnecessary [code]".."[/code] and [code]"/"[/code]. [codeblock] var simple_path = "./path/to///../file".simplify_path() print(simple_path) # Prints "path/file" [/codeblock]

func (String) Split

func (self String) Split(ctx Lifetime, delimiter String, allow_empty bool, maxsplit Int) PackedStringArray

Splits the string using a [param delimiter] and returns an array of the substrings. If [param delimiter] is an empty string, each substring will be a single character. This method is the opposite of [method join]. If [param allow_empty] is [code]false[/code], empty strings between adjacent delimiters are excluded from the array. If [param maxsplit] is greater than [code]0[/code], the number of splits may not exceed [param maxsplit]. By default, the entire string is split. [b]Example:[/b] [codeblocks] [gdscript] var some_array = "One,Two,Three,Four".split(",", true, 2)

print(some_array.size()) # Prints 3 print(some_array[0]) # Prints "One" print(some_array[1]) # Prints "Two" print(some_array[2]) # Prints "Three,Four" [/gdscript] [csharp] // C#'s `Split()` does not support the `maxsplit` parameter. var someArray = "One,Two,Three".Split(",");

GD.Print(someArray[0]); // Prints "One" GD.Print(someArray[1]); // Prints "Two" GD.Print(someArray[2]); // Prints "Three" [/csharp] [/codeblocks] [b]Note:[/b] If you only need one substring from the array, consider using [method get_slice] which is faster. If you need to split strings with more complex rules, use the [RegEx] class instead.

func (String) SplitFloats

func (self String) SplitFloats(ctx Lifetime, delimiter String, allow_empty bool) PackedFloat64Array

Splits the string into floats by using a [param delimiter] and returns a PackedFloat64Array. If [param allow_empty] is [code]false[/code], empty or invalid [float] conversions between adjacent delimiters are excluded. [codeblock] var a = "1,2,4.5".split_floats(",") # a is [1.0, 2.0, 4.5] var c = "1| ||4.5".split_floats("|") # c is [1.0, 0.0, 0.0, 4.5] var b = "1| ||4.5".split_floats("|", false) # b is [1.0, 4.5] [/codeblock]

func (String) String

func (s String) String() string

func (String) StringName

func (s String) StringName(ctx Lifetime) StringName

func (String) StripEdges

func (self String) StripEdges(ctx Lifetime, left bool, right bool) String

Strips all non-printable characters from the beginning and the end of the string. These include spaces, tabulations ([code]\t[/code]), and newlines ([code]\n[/code] [code]\r[/code]). If [param left] is [code]false[/code], ignores the string's beginning. Likewise, if [param right] is [code]false[/code], ignores the string's end.

func (String) StripEscapes

func (self String) StripEscapes(ctx Lifetime) String

Strips all escape characters from the string. These include all non-printable control characters of the first page of the ASCII table (values from 0 to 31), such as tabulation ([code]\t[/code]) and newline ([code]\n[/code], [code]\r[/code]) characters, but [i]not[/i] spaces.

func (String) Substr

func (self String) Substr(ctx Lifetime, from Int, len Int) String

Returns part of the string from the position [param from] with length [param len]. If [param len] is [code]-1[/code] (as by default), returns the rest of the string starting from the given position.

func (String) ToAsciiBuffer

func (self String) ToAsciiBuffer(ctx Lifetime) PackedByteArray

Converts the string to an [url=https://en.wikipedia.org/wiki/ASCII]ASCII[/url]/Latin-1 encoded PackedByteArray. This method is slightly faster than [method to_utf8_buffer], but replaces all unsupported characters with spaces. This is the inverse of [method PackedByteArray.get_string_from_ascii].

func (String) ToCamelCase

func (self String) ToCamelCase(ctx Lifetime) String

Returns the string converted to [code]camelCase[/code].

func (String) ToFloat

func (self String) ToFloat() Float

Converts the string representing a decimal number into a [float]. This method stops on the first non-number character, except the first decimal point ([code].[/code]) and the exponent letter ([code]e[/code]). See also [method is_valid_float]. [codeblock] var a = "12.35".to_float() # a is 12.35 var b = "1.2.3".to_float() # b is 1.2 var c = "12xy3".to_float() # c is 12.0 var d = "1e3".to_float() # d is 1000.0 var e = "Hello!".to_float() # e is 0.0 [/codeblock]

func (String) ToInt

func (self String) ToInt() Int

Converts the string representing an integer number into an [int]. This method removes any non-number character and stops at the first decimal point ([code].[/code]). See also [method is_valid_int]. [codeblock] var a = "123".to_int() # a is 123 var b = "x1y2z3".to_int() # b is 123 var c = "-1.2.3".to_int() # c is -1 var d = "Hello!".to_int() # d is 0 [/codeblock]

func (String) ToLower

func (self String) ToLower(ctx Lifetime) String

Returns the string converted to [code]lowercase[/code].

func (String) ToPascalCase

func (self String) ToPascalCase(ctx Lifetime) String

Returns the string converted to [code]PascalCase[/code].

func (String) ToSnakeCase

func (self String) ToSnakeCase(ctx Lifetime) String

Returns the string converted to [code]snake_case[/code]. [b]Note:[/b] Numbers followed by a [i]single[/i] letter are not separated in the conversion to keep some words (such as "2D") together. [codeblocks] [gdscript] "Node2D".to_snake_case() # Returns "node_2d" "2nd place".to_snake_case() # Returns "2_nd_place" "Texture3DAssetFolder".to_snake_case() # Returns "texture_3d_asset_folder" [/gdscript] [csharp] "Node2D".ToSnakeCase(); // Returns "node_2d" "2nd place".ToSnakeCase(); // Returns "2_nd_place" "Texture3DAssetFolder".ToSnakeCase(); // Returns "texture_3d_asset_folder" [/csharp] [/codeblocks]

func (String) ToUpper

func (self String) ToUpper(ctx Lifetime) String

Returns the string converted to [code]UPPERCASE[/code].

func (String) ToUtf16Buffer

func (self String) ToUtf16Buffer(ctx Lifetime) PackedByteArray

Converts the string to a [url=https://en.wikipedia.org/wiki/UTF-16]UTF-16[/url] encoded PackedByteArray. This is the inverse of [method PackedByteArray.get_string_from_utf16].

func (String) ToUtf32Buffer

func (self String) ToUtf32Buffer(ctx Lifetime) PackedByteArray

Converts the string to a [url=https://en.wikipedia.org/wiki/UTF-32]UTF-32[/url] encoded PackedByteArray. This is the inverse of [method PackedByteArray.get_string_from_utf32].

func (String) ToUtf8Buffer

func (self String) ToUtf8Buffer(ctx Lifetime) PackedByteArray

Converts the string to a [url=https://en.wikipedia.org/wiki/UTF-8]UTF-8[/url] encoded PackedByteArray. This method is slightly slower than [method to_ascii_buffer], but supports all UTF-8 characters. For most cases, prefer using this method. This is the inverse of [method PackedByteArray.get_string_from_utf8].

func (String) ToWcharBuffer

func (self String) ToWcharBuffer(ctx Lifetime) PackedByteArray

Converts the string to a [url=https://en.wikipedia.org/wiki/Wide_character]wide character[/url] ([code]wchar_t[/code], UTF-16 on Windows, UTF-32 on other platforms) encoded PackedByteArray. This is the inverse of [method PackedByteArray.get_string_from_wchar].

func (String) TrimPrefix

func (self String) TrimPrefix(ctx Lifetime, prefix String) String

Removes the given [param prefix] from the start of the string, or returns the string unchanged.

func (String) TrimSuffix

func (self String) TrimSuffix(ctx Lifetime, suffix String) String

Removes the given [param suffix] from the end of the string, or returns the string unchanged.

func (String) UnicodeAt

func (self String) UnicodeAt(at Int) Int

Returns the character code at position [param at].

func (String) UnsafePointer

func (s String) UnsafePointer() unsafe.Pointer

func (String) UriDecode

func (self String) UriDecode(ctx Lifetime) String

Decodes the string from its URL-encoded format. This method is meant to properly decode the parameters in a URL when receiving an HTTP request. See also [method uri_encode]. [codeblocks] [gdscript] var url = "$DOCS_URL/?highlight=Godot%20Engine%3%docs" print(url.uri_decode()) # Prints "$DOCS_URL/?highlight=Godot Engine:docs" [/gdscript] [csharp] var url = "$DOCS_URL/?highlight=Godot%20Engine%3%docs" GD.Print(url.URIDecode()) // Prints "$DOCS_URL/?highlight=Godot Engine:docs" [/csharp] [/codeblocks]

func (String) UriEncode

func (self String) UriEncode(ctx Lifetime) String

Encodes the string to URL-friendly format. This method is meant to properly encode the parameters in a URL when sending an HTTP request. See also [method uri_decode]. [codeblocks] [gdscript] var prefix = "$DOCS_URL/?highlight=" var url = prefix + "Godot Engine:docs".uri_encode()

print(url) # Prints "$DOCS_URL/?highlight=Godot%20Engine%3%docs" [/gdscript] [csharp] var prefix = "$DOCS_URL/?highlight="; var url = prefix + "Godot Engine:docs".URIEncode();

GD.Print(url); // Prints "$DOCS_URL/?highlight=Godot%20Engine%3%docs" [/csharp] [/codeblocks]

func (String) ValidateFilename

func (self String) ValidateFilename(ctx Lifetime) String

Returns a copy of the string with all characters that are not allowed in [method is_valid_filename] replaced with underscores.

func (String) ValidateNodeName

func (self String) ValidateNodeName(ctx Lifetime) String

Returns a copy of the string with all characters that are not allowed in [member Node.name] ([code].[/code] [code]:[/code] [code]@[/code] [code]/[/code] [code]"[/code] [code]%[/code]) replaced with underscores.

func (String) XmlEscape

func (self String) XmlEscape(ctx Lifetime, escape_quotes bool) String

Returns a copy of the string with special characters escaped using the XML standard. If [param escape_quotes] is [code]true[/code], the single quote ([code]'[/code]) and double quote ([code]"[/code]) characters are also escaped.

func (String) XmlUnescape

func (self String) XmlUnescape(ctx Lifetime) String

Returns a copy of the string with escaped characters replaced by their meanings according to the XML standard.

type StringName

type StringName mmm.Pointer[API, StringName, uintptr]

func (StringName) BeginsWith

func (self StringName) BeginsWith(text String) bool

Returns [code]true[/code] if the string begins with the given [param text]. See also [method ends_with].

func (StringName) Bigrams

func (self StringName) Bigrams(ctx Lifetime) PackedStringArray

Returns an array containing the bigrams (pairs of consecutive characters) of this string. [codeblock] print("Get up!".bigrams()) # Prints ["Ge", "et", "t ", " u", "up", "p!"] [/codeblock]

func (StringName) BinToInt

func (self StringName) BinToInt() Int

Converts the string representing a binary number into an [int]. The string may optionally be prefixed with [code]"0b"[/code], and an additional [code]-[/code] prefix for negative numbers. [codeblocks] [gdscript] print("101".bin_to_int()) # Prints 5 print("0b101".bin_to_int()) # Prints 5 print("-0b10".bin_to_int()) # Prints -2 [/gdscript] [csharp] GD.Print("101".BinToInt()); // Prints 5 GD.Print("0b101".BinToInt()); // Prints 5 GD.Print("-0b10".BinToInt()); // Prints -2 [/csharp] [/codeblocks]

func (StringName) CEscape

func (self StringName) CEscape(ctx Lifetime) String

Returns a copy of the string with special characters escaped using the C language standard.

func (StringName) CUnescape

func (self StringName) CUnescape(ctx Lifetime) String

Returns a copy of the string with escaped characters replaced by their meanings. Supported escape sequences are [code]\'[/code], [code]\"[/code], [code]\\[/code], [code]\a[/code], [code]\b[/code], [code]\f[/code], [code]\n[/code], [code]\r[/code], [code]\t[/code], [code]\v[/code]. [b]Note:[/b] Unlike the GDScript parser, this method doesn't support the [code]\uXXXX[/code] escape sequence.

func (StringName) Capitalize

func (self StringName) Capitalize(ctx Lifetime) String

Changes the appearance of the string: replaces underscores ([code]_[/code]) with spaces, adds spaces before uppercase letters in the middle of a word, converts all letters to lowercase, then converts the first one and each one following a space to uppercase. [codeblocks] [gdscript] "move_local_x".capitalize() # Returns "Move Local X" "sceneFile_path".capitalize() # Returns "Scene File Path" "2D, FPS, PNG".capitalize() # Returns "2d, Fps, Png" [/gdscript] [csharp] "move_local_x".Capitalize(); // Returns "Move Local X" "sceneFile_path".Capitalize(); // Returns "Scene File Path" "2D, FPS, PNG".Capitalize(); // Returns "2d, Fps, Png" [/csharp] [/codeblocks]

func (StringName) CasecmpTo

func (self StringName) CasecmpTo(to String) Int

Performs a case-sensitive comparison to another string. Returns [code]-1[/code] if less than, [code]1[/code] if greater than, or [code]0[/code] if equal. "Less than" and "greater than" are determined by the [url=https://en.wikipedia.org/wiki/List_of_Unicode_characters]Unicode code points[/url] of each string, which roughly matches the alphabetical order. With different string lengths, returns [code]1[/code] if this string is longer than the [param to] string, or [code]-1[/code] if shorter. Note that the length of empty strings is [i]always[/i] [code]0[/code]. To get a [bool] result from a string comparison, use the [code]==[/code] operator instead. See also [method nocasecmp_to], [method filecasecmp_to], and [method naturalcasecmp_to].

func (StringName) Contains

func (self StringName) Contains(what String) bool

Returns [code]true[/code] if the string contains [param what]. In GDScript, this corresponds to the [code]in[/code] operator. [codeblocks] [gdscript] print("Node".contains("de")) # Prints true print("team".contains("I")) # Prints false print("I" in "team") # Prints false [/gdscript] [csharp] GD.Print("Node".Contains("de")); // Prints true GD.Print("team".Contains("I")); // Prints false [/csharp] [/codeblocks] If you need to know where [param what] is within the string, use [method find]. See also [method containsn].

func (StringName) Containsn

func (self StringName) Containsn(what String) bool

Returns [code]true[/code] if the string contains [param what], [b]ignoring case[/b]. If you need to know where [param what] is within the string, use [method findn]. See also [method contains].

func (StringName) Count

func (self StringName) Count(what String, from Int, to Int) Int

Returns the number of occurrences of the substring [param what] between [param from] and [param to] positions. If [param to] is 0, the search continues until the end of the string.

func (StringName) Countn

func (self StringName) Countn(what String, from Int, to Int) Int

Returns the number of occurrences of the substring [param what] between [param from] and [param to] positions, [b]ignoring case[/b]. If [param to] is 0, the search continues until the end of the string.

func (StringName) Dedent

func (self StringName) Dedent(ctx Lifetime) String

Returns a copy of the string with indentation (leading tabs and spaces) removed. See also [method indent] to add indentation.

func (StringName) EndsWith

func (self StringName) EndsWith(text String) bool

Returns [code]true[/code] if the string ends with the given [param text]. See also [method begins_with].

func (StringName) Erase

func (self StringName) Erase(ctx Lifetime, position Int, chars Int) String

Returns a string with [param chars] characters erased starting from [param position]. If [param chars] goes beyond the string's length given the specified [param position], fewer characters will be erased from the returned string. Returns an empty string if either [param position] or [param chars] is negative. Returns the original string unmodified if [param chars] is [code]0[/code].

func (StringName) FilecasecmpTo

func (self StringName) FilecasecmpTo(to String) Int

Like [method naturalcasecmp_to] but prioritizes strings that begin with periods ([code].[/code]) and underscores ([code]_[/code]) before any other character. Useful when sorting folders or file names. To get a [bool] result from a string comparison, use the [code]==[/code] operator instead. See also [method filenocasecmp_to], [method naturalcasecmp_to], and [method casecmp_to].

func (StringName) FilenocasecmpTo

func (self StringName) FilenocasecmpTo(to String) Int

Like [method naturalnocasecmp_to] but prioritizes strings that begin with periods ([code].[/code]) and underscores ([code]_[/code]) before any other character. Useful when sorting folders or file names. To get a [bool] result from a string comparison, use the [code]==[/code] operator instead. See also [method filecasecmp_to], [method naturalnocasecmp_to], and [method nocasecmp_to].

func (StringName) Find

func (self StringName) Find(what String, from Int) Int

Returns the index of the [b]first[/b] occurrence of [param what] in this string, or [code]-1[/code] if there are none. The search's start can be specified with [param from], continuing to the end of the string. [codeblocks] [gdscript] print("Team".find("I")) # Prints -1

print("Potato".find("t")) # Prints 2 print("Potato".find("t", 3)) # Prints 4 print("Potato".find("t", 5)) # Prints -1 [/gdscript] [csharp] GD.Print("Team".Find("I")); // Prints -1

GD.Print("Potato".Find("t")); // Prints 2 GD.Print("Potato".Find("t", 3)); // Prints 4 GD.Print("Potato".Find("t", 5)); // Prints -1 [/csharp] [/codeblocks] [b]Note:[/b] If you just want to know whether the string contains [param what], use [method contains]. In GDScript, you may also use the [code]in[/code] operator.

func (StringName) Findn

func (self StringName) Findn(what String, from Int) Int

Returns the index of the [b]first[/b] [b]case-insensitive[/b] occurrence of [param what] in this string, or [code]-1[/code] if there are none. The starting search index can be specified with [param from], continuing to the end of the string.

func (StringName) Format

func (self StringName) Format(ctx Lifetime, values Variant, placeholder String) String

Formats the string by replacing all occurrences of [param placeholder] with the elements of [param values]. [param values] can be a Dictionary or an Array. Any underscores in [param placeholder] will be replaced with the corresponding keys in advance. Array elements use their index as keys. [codeblock] # Prints "Waiting for Godot is a play by Samuel Beckett, and Godot Engine is named after it." var use_array_values = "Waiting for {0} is a play by {1}, and {0} Engine is named after it." print(use_array_values.format(["Godot", "Samuel Beckett"]))

# Prints "User 42 is Godot." print("User {id} is {name}.".format({"id": 42, "name": "Godot"})) [/codeblock] Some additional handling is performed when [param values] is an Array. If [param placeholder] does not contain an underscore, the elements of the [param values] array will be used to replace one occurrence of the placeholder in order; If an element of [param values] is another 2-element array, it'll be interpreted as a key-value pair. [codeblock] # Prints "User 42 is Godot." print("User {} is {}.".format([42, "Godot"], "{}")) print("User {id} is {name}.".format([["id", 42], ["name", "Godot"]])) [/codeblock] See also the [url=$DOCS_URL/tutorials/scripting/gdscript/gdscript_format_string.html]GDScript format string[/url] tutorial. [b]Note:[/b] In C#, it's recommended to [url=https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/interpolated]interpolate strings with "$"[/url], instead.

func (StringName) Free

func (s StringName) Free()

func (StringName) GetBaseDir

func (self StringName) GetBaseDir(ctx Lifetime) String

If the string is a valid file path, returns the base directory name. [codeblock] var dir_path = "/path/to/file.txt".get_base_dir() # dir_path is "/path/to" [/codeblock]

func (StringName) GetBasename

func (self StringName) GetBasename(ctx Lifetime) String

If the string is a valid file path, returns the full file path, without the extension. [codeblock] var base = "/path/to/file.txt".get_basename() # base is "/path/to/file" [/codeblock]

func (StringName) GetExtension

func (self StringName) GetExtension(ctx Lifetime) String

If the string is a valid file name or path, returns the file extension without the leading period ([code].[/code]). Otherwise, returns an empty string. [codeblock] var a = "/path/to/file.txt".get_extension() # a is "txt" var b = "cool.txt".get_extension() # b is "txt" var c = "cool.font.tres".get_extension() # c is "tres" var d = ".pack1".get_extension() # d is "pack1"

var e = "file.txt.".get_extension() # e is "" var f = "file.txt..".get_extension() # f is "" var g = "txt".get_extension() # g is "" var h = "".get_extension() # h is "" [/codeblock]

func (StringName) GetFile

func (self StringName) GetFile(ctx Lifetime) String

If the string is a valid file path, returns the file name, including the extension. [codeblock] var file = "/path/to/icon.png".get_file() # file is "icon.png" [/codeblock]

func (StringName) GetSlice

func (self StringName) GetSlice(ctx Lifetime, delimiter String, slice Int) String

Splits the string using a [param delimiter] and returns the substring at index [param slice]. Returns an empty string if the [param slice] does not exist. This is faster than [method split], if you only need one substring. [b]Example:[/b] [codeblock] print("i/am/example/hi".get_slice("/", 2)) # Prints "example" [/codeblock]

func (StringName) GetSliceCount

func (self StringName) GetSliceCount(delimiter String) Int

Returns the total number of slices when the string is split with the given [param delimiter] (see [method split]).

func (StringName) GetSlicec

func (self StringName) GetSlicec(ctx Lifetime, delimiter Int, slice Int) String

Splits the string using a Unicode character with code [param delimiter] and returns the substring at index [param slice]. Returns an empty string if the [param slice] does not exist. This is faster than [method split], if you only need one substring.

func (StringName) Hash

func (self StringName) Hash() Int

Returns the 32-bit hash value representing the string's contents. [b]Note:[/b] Strings with equal hash values are [i]not[/i] guaranteed to be the same, as a result of hash collisions. On the contrary, strings with different hash values are guaranteed to be different.

func (StringName) HexDecode

func (self StringName) HexDecode(ctx Lifetime) PackedByteArray

Decodes a hexadecimal string as a PackedByteArray. [codeblocks] [gdscript] var text = "hello world" var encoded = text.to_utf8_buffer().hex_encode() # outputs "68656c6c6f20776f726c64" print(buf.hex_decode().get_string_from_utf8()) [/gdscript] [csharp] var text = "hello world"; var encoded = text.ToUtf8Buffer().HexEncode(); // outputs "68656c6c6f20776f726c64" GD.Print(buf.HexDecode().GetStringFromUtf8()); [/csharp] [/codeblocks]

func (StringName) HexToInt

func (self StringName) HexToInt() Int

Converts the string representing a hexadecimal number into an [int]. The string may be optionally prefixed with [code]"0x"[/code], and an additional [code]-[/code] prefix for negative numbers. [codeblocks] [gdscript] print("0xff".hex_to_int()) # Prints 255 print("ab".hex_to_int()) # Prints 171 [/gdscript] [csharp] GD.Print("0xff".HexToInt()); // Prints 255 GD.Print("ab".HexToInt()); // Prints 171 [/csharp] [/codeblocks]

func (StringName) Indent

func (self StringName) Indent(ctx Lifetime, prefix String) String

Indents every line of the string with the given [param prefix]. Empty lines are not indented. See also [method dedent] to remove indentation. For example, the string can be indented with two tabulations using [code]"\t\t"[/code], or four spaces using [code]" "[/code].

func (StringName) Insert

func (self StringName) Insert(ctx Lifetime, position Int, what String) String

Inserts [param what] at the given [param position] in the string.

func (StringName) IsAbsolutePath

func (self StringName) IsAbsolutePath() bool

Returns [code]true[/code] if the string is a path to a file or directory, and its starting point is explicitly defined. This method is the opposite of [method is_relative_path]. This includes all paths starting with [code]"res://"[/code], [code]"user://"[/code], [code]"C:\"[/code], [code]"/"[/code], etc.

func (StringName) IsEmpty

func (self StringName) IsEmpty() bool

Returns [code]true[/code] if the string's length is [code]0[/code] ([code]""[/code]). See also [method length].

func (StringName) IsRelativePath

func (self StringName) IsRelativePath() bool

Returns [code]true[/code] if the string is a path, and its starting point is dependent on context. The path could begin from the current directory, or the current [Node] (if the string is derived from a NodePath), and may sometimes be prefixed with [code]"./"[/code]. This method is the opposite of [method is_absolute_path].

func (StringName) IsSubsequenceOf

func (self StringName) IsSubsequenceOf(text String) bool

Returns [code]true[/code] if all characters of this string can be found in [param text] in their original order. [codeblock] var text = "Wow, incredible!"

print("inedible".is_subsequence_of(text)) # Prints true print("Word!".is_subsequence_of(text)) # Prints true print("Window".is_subsequence_of(text)) # Prints false print("".is_subsequence_of(text)) # Prints true [/codeblock]

func (StringName) IsSubsequenceOfn

func (self StringName) IsSubsequenceOfn(text String) bool

Returns [code]true[/code] if all characters of this string can be found in [param text] in their original order, [b]ignoring case[/b].

func (StringName) IsValidFilename

func (self StringName) IsValidFilename() bool

Returns [code]true[/code] if this string does not contain characters that are not allowed in file names ([code]:[/code] [code]/[/code] [code]\[/code] [code]?[/code] [code]*[/code] [code]"[/code] [code]|[/code] [code]%[/code] [code]<[/code] [code]>[/code]).

func (StringName) IsValidFloat

func (self StringName) IsValidFloat() bool

Returns [code]true[/code] if this string represents a valid floating-point number. A valid float may contain only digits, one decimal point ([code].[/code]), and the exponent letter ([code]e[/code]). It may also be prefixed with a positive ([code]+[/code]) or negative ([code]-[/code]) sign. Any valid integer is also a valid float (see [method is_valid_int]). See also [method to_float]. [codeblock] print("1.7".is_valid_float()) # Prints true print("24".is_valid_float()) # Prints true print("7e3".is_valid_float()) # Prints true print("Hello".is_valid_float()) # Prints false [/codeblock]

func (StringName) IsValidHexNumber

func (self StringName) IsValidHexNumber(with_prefix bool) bool

Returns [code]true[/code] if this string is a valid hexadecimal number. A valid hexadecimal number only contains digits or letters [code]A[/code] to [code]F[/code] (either uppercase or lowercase), and may be prefixed with a positive ([code]+[/code]) or negative ([code]-[/code]) sign. If [param with_prefix] is [code]true[/code], the hexadecimal number needs to prefixed by [code]"0x"[/code] to be considered valid. [codeblock] print("A08E".is_valid_hex_number()) # Prints true print("-AbCdEf".is_valid_hex_number()) # Prints true print("2.5".is_valid_hex_number()) # Prints false

print("0xDEADC0DE".is_valid_hex_number(true)) # Prints true [/codeblock]

func (StringName) IsValidHtmlColor

func (self StringName) IsValidHtmlColor() bool

Returns [code]true[/code] if this string is a valid color in hexadecimal HTML notation. The string must be a hexadecimal value (see [method is_valid_hex_number]) of either 3, 4, 6 or 8 digits, and may be prefixed by a hash sign ([code]#[/code]). Other HTML notations for colors, such as names or [code]hsl()[/code], are not considered valid. See also [method Color.html].

func (StringName) IsValidIdentifier

func (self StringName) IsValidIdentifier() bool

Returns [code]true[/code] if this string is a valid identifier. A valid identifier may contain only letters, digits and underscores ([code]_[/code]), and the first character may not be a digit. [codeblock] print("node_2d".is_valid_identifier()) # Prints true print("TYPE_FLOAT".is_valid_identifier()) # Prints true print("1st_method".is_valid_identifier()) # Prints false print("MyMethod#2".is_valid_identifier()) # Prints false [/codeblock]

func (StringName) IsValidInt

func (self StringName) IsValidInt() bool

Returns [code]true[/code] if this string represents a valid integer. A valid integer only contains digits, and may be prefixed with a positive ([code]+[/code]) or negative ([code]-[/code]) sign. See also [method to_int]. [codeblock] print("7".is_valid_int()) # Prints true print("1.65".is_valid_int()) # Prints false print("Hi".is_valid_int()) # Prints false print("+3".is_valid_int()) # Prints true print("-12".is_valid_int()) # Prints true [/codeblock]

func (StringName) IsValidIpAddress

func (self StringName) IsValidIpAddress() bool

Returns [code]true[/code] if this string represents a well-formatted IPv4 or IPv6 address. This method considers [url=https://en.wikipedia.org/wiki/Reserved_IP_addresses]reserved IP addresses[/url] such as [code]"0.0.0.0"[/code] and [code]"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"[/code] as valid.

func (StringName) Join

func (self StringName) Join(ctx Lifetime, parts PackedStringArray) String

Returns the concatenation of [param parts]' elements, with each element separated by the string calling this method. This method is the opposite of [method split]. [b]Example:[/b] [codeblocks] [gdscript] var fruits = ["Apple", "Orange", "Pear", "Kiwi"]

print(", ".join(fruits)) # Prints "Apple, Orange, Pear, Kiwi" print("---".join(fruits)) # Prints "Apple---Orange---Pear---Kiwi" [/gdscript] [csharp] var fruits = new string[] {"Apple", "Orange", "Pear", "Kiwi"};

// In C#, this method is static. GD.Print(string.Join(", ", fruits)); // Prints "Apple, Orange, Pear, Kiwi" GD.Print(string.Join("---", fruits)); // Prints "Apple---Orange---Pear---Kiwi" [/csharp] [/codeblocks]

func (StringName) JsonEscape

func (self StringName) JsonEscape(ctx Lifetime) String

Returns a copy of the string with special characters escaped using the JSON standard. Because it closely matches the C standard, it is possible to use [method c_unescape] to unescape the string, if necessary.

func (StringName) Left

func (self StringName) Left(ctx Lifetime, length Int) String

Returns the first [param length] characters from the beginning of the string. If [param length] is negative, strips the last [param length] characters from the string's end. [codeblock] print("Hello World!".left(3)) # Prints "Hel" print("Hello World!".left(-4)) # Prints "Hello Wo" [/codeblock]

func (StringName) Length

func (self StringName) Length() Int

Returns the number of characters in the string. Empty strings ([code]""[/code]) always return [code]0[/code]. See also [method is_empty].

func (StringName) Lpad

func (self StringName) Lpad(ctx Lifetime, min_length Int, character String) String

Formats the string to be at least [param min_length] long by adding [param character]s to the left of the string, if necessary. See also [method rpad].

func (StringName) Lstrip

func (self StringName) Lstrip(ctx Lifetime, chars String) String

Removes a set of characters defined in [param chars] from the string's beginning. See also [method rstrip]. [b]Note:[/b] [param chars] is not a prefix. Use [method trim_prefix] to remove a single prefix, rather than a set of characters.

func (StringName) Match

func (self StringName) Match(expr String) bool

Does a simple expression match (also called "glob" or "globbing"), where [code]*[/code] matches zero or more arbitrary characters and [code]?[/code] matches any single character except a period ([code].[/code]). An empty string or empty expression always evaluates to [code]false[/code].

func (StringName) Matchn

func (self StringName) Matchn(expr String) bool

Does a simple [b]case-insensitive[/b] expression match, where [code]*[/code] matches zero or more arbitrary characters and [code]?[/code] matches any single character except a period ([code].[/code]). An empty string or empty expression always evaluates to [code]false[/code].

func (StringName) Md5Buffer

func (self StringName) Md5Buffer(ctx Lifetime) PackedByteArray

Returns the [url=https://en.wikipedia.org/wiki/MD5]MD5 hash[/url] of the string as a PackedByteArray.

func (StringName) Md5Text

func (self StringName) Md5Text(ctx Lifetime) String

Returns the [url=https://en.wikipedia.org/wiki/MD5]MD5 hash[/url] of the string as another String.

func (StringName) NaturalcasecmpTo

func (self StringName) NaturalcasecmpTo(to String) Int

Performs a [b]case-sensitive[/b], [i]natural order[/i] comparison to another string. Returns [code]-1[/code] if less than, [code]1[/code] if greater than, or [code]0[/code] if equal. "Less than" or "greater than" are determined by the [url=https://en.wikipedia.org/wiki/List_of_Unicode_characters]Unicode code points[/url] of each string, which roughly matches the alphabetical order. When used for sorting, natural order comparison orders sequences of numbers by the combined value of each digit as is often expected, instead of the single digit's value. A sorted sequence of numbered strings will be [code]["1", "2", "3", ...][/code], not [code]["1", "10", "2", "3", ...][/code]. With different string lengths, returns [code]1[/code] if this string is longer than the [param to] string, or [code]-1[/code] if shorter. Note that the length of empty strings is [i]always[/i] [code]0[/code]. To get a [bool] result from a string comparison, use the [code]==[/code] operator instead. See also [method naturalnocasecmp_to], [method filecasecmp_to], and [method nocasecmp_to].

func (StringName) NaturalnocasecmpTo

func (self StringName) NaturalnocasecmpTo(to String) Int

Performs a [b]case-insensitive[/b], [i]natural order[/i] comparison to another string. Returns [code]-1[/code] if less than, [code]1[/code] if greater than, or [code]0[/code] if equal. "Less than" or "greater than" are determined by the [url=https://en.wikipedia.org/wiki/List_of_Unicode_characters]Unicode code points[/url] of each string, which roughly matches the alphabetical order. Internally, lowercase characters are converted to uppercase for the comparison. When used for sorting, natural order comparison orders sequences of numbers by the combined value of each digit as is often expected, instead of the single digit's value. A sorted sequence of numbered strings will be [code]["1", "2", "3", ...][/code], not [code]["1", "10", "2", "3", ...][/code]. With different string lengths, returns [code]1[/code] if this string is longer than the [param to] string, or [code]-1[/code] if shorter. Note that the length of empty strings is [i]always[/i] [code]0[/code]. To get a [bool] result from a string comparison, use the [code]==[/code] operator instead. See also [method naturalcasecmp_to], [method filenocasecmp_to], and [method casecmp_to].

func (StringName) NocasecmpTo

func (self StringName) NocasecmpTo(to String) Int

Performs a [b]case-insensitive[/b] comparison to another string. Returns [code]-1[/code] if less than, [code]1[/code] if greater than, or [code]0[/code] if equal. "Less than" or "greater than" are determined by the [url=https://en.wikipedia.org/wiki/List_of_Unicode_characters]Unicode code points[/url] of each string, which roughly matches the alphabetical order. Internally, lowercase characters are converted to uppercase for the comparison. With different string lengths, returns [code]1[/code] if this string is longer than the [param to] string, or [code]-1[/code] if shorter. Note that the length of empty strings is [i]always[/i] [code]0[/code]. To get a [bool] result from a string comparison, use the [code]==[/code] operator instead. See also [method casecmp_to], [method filenocasecmp_to], and [method naturalnocasecmp_to].

func (StringName) PadDecimals

func (self StringName) PadDecimals(ctx Lifetime, digits Int) String

Formats the string representing a number to have an exact number of [param digits] [i]after[/i] the decimal point.

func (StringName) PadZeros

func (self StringName) PadZeros(ctx Lifetime, digits Int) String

Formats the string representing a number to have an exact number of [param digits] [i]before[/i] the decimal point.

func (StringName) PathJoin

func (self StringName) PathJoin(ctx Lifetime, file String) String

Concatenates [param file] at the end of the string as a subpath, adding [code]/[/code] if necessary. [b]Example:[/b] [code]"this/is".path_join("path") == "this/is/path"[/code].

func (StringName) Repeat

func (self StringName) Repeat(ctx Lifetime, count Int) String

Repeats this string a number of times. [param count] needs to be greater than [code]0[/code]. Otherwise, returns an empty string.

func (StringName) Replace

func (self StringName) Replace(ctx Lifetime, what String, forwhat String) String

Replaces all occurrences of [param what] inside the string with the given [param forwhat].

func (StringName) Replacen

func (self StringName) Replacen(ctx Lifetime, what String, forwhat String) String

Replaces all [b]case-insensitive[/b] occurrences of [param what] inside the string with the given [param forwhat].

func (StringName) Reverse

func (self StringName) Reverse(ctx Lifetime) String

Returns the copy of this string in reverse order. This operation works on unicode codepoints, rather than sequences of codepoints, and may break things like compound letters or emojis.

func (StringName) Rfind

func (self StringName) Rfind(what String, from Int) Int

Returns the index of the [b]last[/b] occurrence of [param what] in this string, or [code]-1[/code] if there are none. The search's start can be specified with [param from], continuing to the beginning of the string. This method is the reverse of [method find].

func (StringName) Rfindn

func (self StringName) Rfindn(what String, from Int) Int

Returns the index of the [b]last[/b] [b]case-insensitive[/b] occurrence of [param what] in this string, or [code]-1[/code] if there are none. The starting search index can be specified with [param from], continuing to the beginning of the string. This method is the reverse of [method findn].

func (StringName) Right

func (self StringName) Right(ctx Lifetime, length Int) String

Returns the last [param length] characters from the end of the string. If [param length] is negative, strips the first [param length] characters from the string's beginning. [codeblock] print("Hello World!".right(3)) # Prints "ld!" print("Hello World!".right(-4)) # Prints "o World!" [/codeblock]

func (StringName) Rpad

func (self StringName) Rpad(ctx Lifetime, min_length Int, character String) String

Formats the string to be at least [param min_length] long, by adding [param character]s to the right of the string, if necessary. See also [method lpad].

func (StringName) Rsplit

func (self StringName) Rsplit(ctx Lifetime, delimiter String, allow_empty bool, maxsplit Int) PackedStringArray

Splits the string using a [param delimiter] and returns an array of the substrings, starting from the end of the string. The splits in the returned array appear in the same order as the original string. If [param delimiter] is an empty string, each substring will be a single character. If [param allow_empty] is [code]false[/code], empty strings between adjacent delimiters are excluded from the array. If [param maxsplit] is greater than [code]0[/code], the number of splits may not exceed [param maxsplit]. By default, the entire string is split, which is mostly identical to [method split]. [b]Example:[/b] [codeblocks] [gdscript] var some_string = "One,Two,Three,Four" var some_array = some_string.rsplit(",", true, 1)

print(some_array.size()) # Prints 2 print(some_array[0]) # Prints "One,Two,Three" print(some_array[1]) # Prints "Four" [/gdscript] [csharp] // In C#, there is no String.RSplit() method. [/csharp] [/codeblocks]

func (StringName) Rstrip

func (self StringName) Rstrip(ctx Lifetime, chars String) String

Removes a set of characters defined in [param chars] from the string's end. See also [method lstrip]. [b]Note:[/b] [param chars] is not a suffix. Use [method trim_suffix] to remove a single suffix, rather than a set of characters.

func (StringName) Sha1Buffer

func (self StringName) Sha1Buffer(ctx Lifetime) PackedByteArray

Returns the [url=https://en.wikipedia.org/wiki/SHA-1]SHA-1[/url] hash of the string as a PackedByteArray.

func (StringName) Sha1Text

func (self StringName) Sha1Text(ctx Lifetime) String

Returns the [url=https://en.wikipedia.org/wiki/SHA-1]SHA-1[/url] hash of the string as another String.

func (StringName) Sha256Buffer

func (self StringName) Sha256Buffer(ctx Lifetime) PackedByteArray

Returns the [url=https://en.wikipedia.org/wiki/SHA-2]SHA-256[/url] hash of the string as a PackedByteArray.

func (StringName) Sha256Text

func (self StringName) Sha256Text(ctx Lifetime) String

Returns the [url=https://en.wikipedia.org/wiki/SHA-2]SHA-256[/url] hash of the string as another String.

func (StringName) Similarity

func (self StringName) Similarity(text String) Float

Returns the similarity index ([url=https://en.wikipedia.org/wiki/S%C3%B8rensen%E2%80%93Dice_coefficient]Sorensen-Dice coefficient[/url]) of this string compared to another. A result of [code]1.0[/code] means totally similar, while [code]0.0[/code] means totally dissimilar. [codeblock] print("ABC123".similarity("ABC123")) # Prints 1.0 print("ABC123".similarity("XYZ456")) # Prints 0.0 print("ABC123".similarity("123ABC")) # Prints 0.8 print("ABC123".similarity("abc123")) # Prints 0.4 [/codeblock]

func (StringName) SimplifyPath

func (self StringName) SimplifyPath(ctx Lifetime) String

If the string is a valid file path, converts the string into a canonical path. This is the shortest possible path, without [code]"./"[/code], and all the unnecessary [code]".."[/code] and [code]"/"[/code]. [codeblock] var simple_path = "./path/to///../file".simplify_path() print(simple_path) # Prints "path/file" [/codeblock]

func (StringName) Split

func (self StringName) Split(ctx Lifetime, delimiter String, allow_empty bool, maxsplit Int) PackedStringArray

Splits the string using a [param delimiter] and returns an array of the substrings. If [param delimiter] is an empty string, each substring will be a single character. This method is the opposite of [method join]. If [param allow_empty] is [code]false[/code], empty strings between adjacent delimiters are excluded from the array. If [param maxsplit] is greater than [code]0[/code], the number of splits may not exceed [param maxsplit]. By default, the entire string is split. [b]Example:[/b] [codeblocks] [gdscript] var some_array = "One,Two,Three,Four".split(",", true, 2)

print(some_array.size()) # Prints 3 print(some_array[0]) # Prints "One" print(some_array[1]) # Prints "Two" print(some_array[2]) # Prints "Three,Four" [/gdscript] [csharp] // C#'s `Split()` does not support the `maxsplit` parameter. var someArray = "One,Two,Three".Split(",");

GD.Print(someArray[0]); // Prints "One" GD.Print(someArray[1]); // Prints "Two" GD.Print(someArray[2]); // Prints "Three" [/csharp] [/codeblocks] [b]Note:[/b] If you only need one substring from the array, consider using [method get_slice] which is faster. If you need to split strings with more complex rules, use the [RegEx] class instead.

func (StringName) SplitFloats

func (self StringName) SplitFloats(ctx Lifetime, delimiter String, allow_empty bool) PackedFloat64Array

Splits the string into floats by using a [param delimiter] and returns a PackedFloat64Array. If [param allow_empty] is [code]false[/code], empty or invalid [float] conversions between adjacent delimiters are excluded. [codeblock] var a = "1,2,4.5".split_floats(",") # a is [1.0, 2.0, 4.5] var c = "1| ||4.5".split_floats("|") # c is [1.0, 0.0, 0.0, 4.5] var b = "1| ||4.5".split_floats("|", false) # b is [1.0, 4.5] [/codeblock]

func (StringName) String

func (s StringName) String() string

func (StringName) StripEdges

func (self StringName) StripEdges(ctx Lifetime, left bool, right bool) String

Strips all non-printable characters from the beginning and the end of the string. These include spaces, tabulations ([code]\t[/code]), and newlines ([code]\n[/code] [code]\r[/code]). If [param left] is [code]false[/code], ignores the string's beginning. Likewise, if [param right] is [code]false[/code], ignores the string's end.

func (StringName) StripEscapes

func (self StringName) StripEscapes(ctx Lifetime) String

Strips all escape characters from the string. These include all non-printable control characters of the first page of the ASCII table (values from 0 to 31), such as tabulation ([code]\t[/code]) and newline ([code]\n[/code], [code]\r[/code]) characters, but [i]not[/i] spaces.

func (StringName) Substr

func (self StringName) Substr(ctx Lifetime, from Int, len Int) String

Returns part of the string from the position [param from] with length [param len]. If [param len] is [code]-1[/code] (as by default), returns the rest of the string starting from the given position.

func (StringName) ToAsciiBuffer

func (self StringName) ToAsciiBuffer(ctx Lifetime) PackedByteArray

Converts the string to an [url=https://en.wikipedia.org/wiki/ASCII]ASCII[/url]/Latin-1 encoded PackedByteArray. This method is slightly faster than [method to_utf8_buffer], but replaces all unsupported characters with spaces.

func (StringName) ToCamelCase

func (self StringName) ToCamelCase(ctx Lifetime) String

Returns the string converted to [code]camelCase[/code].

func (StringName) ToFloat

func (self StringName) ToFloat() Float

Converts the string representing a decimal number into a [float]. This method stops on the first non-number character, except the first decimal point ([code].[/code]) and the exponent letter ([code]e[/code]). See also [method is_valid_float]. [codeblock] var a = "12.35".to_float() # a is 12.35 var b = "1.2.3".to_float() # b is 1.2 var c = "12xy3".to_float() # c is 12.0 var d = "1e3".to_float() # d is 1000.0 var e = "Hello!".to_int() # e is 0.0 [/codeblock]

func (StringName) ToInt

func (self StringName) ToInt() Int

Converts the string representing an integer number into an [int]. This method removes any non-number character and stops at the first decimal point ([code].[/code]). See also [method is_valid_int]. [codeblock] var a = "123".to_int() # a is 123 var b = "x1y2z3".to_int() # b is 123 var c = "-1.2.3".to_int() # c is -1 var d = "Hello!".to_int() # d is 0 [/codeblock]

func (StringName) ToLower

func (self StringName) ToLower(ctx Lifetime) String

Returns the string converted to [code]lowercase[/code].

func (StringName) ToPascalCase

func (self StringName) ToPascalCase(ctx Lifetime) String

Returns the string converted to [code]PascalCase[/code].

func (StringName) ToSnakeCase

func (self StringName) ToSnakeCase(ctx Lifetime) String

Returns the string converted to [code]snake_case[/code]. [b]Note:[/b] Numbers followed by a [i]single[/i] letter are not separated in the conversion to keep some words (such as "2D") together. [codeblocks] [gdscript] "Node2D".to_snake_case() # Returns "node_2d" "2nd place".to_snake_case() # Returns "2_nd_place" "Texture3DAssetFolder".to_snake_case() # Returns "texture_3d_asset_folder" [/gdscript] [csharp] "Node2D".ToSnakeCase(); // Returns "node_2d" "2nd place".ToSnakeCase(); // Returns "2_nd_place" "Texture3DAssetFolder".ToSnakeCase(); // Returns "texture_3d_asset_folder" [/csharp] [/codeblocks]

func (StringName) ToUpper

func (self StringName) ToUpper(ctx Lifetime) String

Returns the string converted to [code]UPPERCASE[/code].

func (StringName) ToUtf16Buffer

func (self StringName) ToUtf16Buffer(ctx Lifetime) PackedByteArray

Converts the string to a [url=https://en.wikipedia.org/wiki/UTF-16]UTF-16[/url] encoded PackedByteArray.

func (StringName) ToUtf32Buffer

func (self StringName) ToUtf32Buffer(ctx Lifetime) PackedByteArray

Converts the string to a [url=https://en.wikipedia.org/wiki/UTF-32]UTF-32[/url] encoded PackedByteArray.

func (StringName) ToUtf8Buffer

func (self StringName) ToUtf8Buffer(ctx Lifetime) PackedByteArray

Converts the string to a [url=https://en.wikipedia.org/wiki/UTF-8]UTF-8[/url] encoded PackedByteArray. This method is slightly slower than [method to_ascii_buffer], but supports all UTF-8 characters. For most cases, prefer using this method.

func (StringName) ToWcharBuffer

func (self StringName) ToWcharBuffer(ctx Lifetime) PackedByteArray

Converts the string to a [url=https://en.wikipedia.org/wiki/Wide_character]wide character[/url] ([code]wchar_t[/code], UTF-16 on Windows, UTF-32 on other platforms) encoded PackedByteArray.

func (StringName) TrimPrefix

func (self StringName) TrimPrefix(ctx Lifetime, prefix String) String

Removes the given [param prefix] from the start of the string, or returns the string unchanged.

func (StringName) TrimSuffix

func (self StringName) TrimSuffix(ctx Lifetime, suffix String) String

Removes the given [param suffix] from the end of the string, or returns the string unchanged.

func (StringName) UnicodeAt

func (self StringName) UnicodeAt(at Int) Int

Returns the character code at position [param at].

func (StringName) UriDecode

func (self StringName) UriDecode(ctx Lifetime) String

Decodes the string from its URL-encoded format. This method is meant to properly decode the parameters in a URL when receiving an HTTP request. [codeblocks] [gdscript] var url = "$DOCS_URL/?highlight=Godot%20Engine%3%docs" print(url.uri_decode()) # Prints "$DOCS_URL/?highlight=Godot Engine:docs" [/gdscript] [csharp] var url = "$DOCS_URL/?highlight=Godot%20Engine%3%docs" GD.Print(url.URIDecode()) // Prints "$DOCS_URL/?highlight=Godot Engine:docs" [/csharp] [/codeblocks]

func (StringName) UriEncode

func (self StringName) UriEncode(ctx Lifetime) String

Encodes the string to URL-friendly format. This method is meant to properly encode the parameters in a URL when sending an HTTP request. [codeblocks] [gdscript] var prefix = "$DOCS_URL/?highlight=" var url = prefix + "Godot Engine:docs".uri_encode()

print(url) # Prints "$DOCS_URL/?highlight=Godot%20Engine%3%docs" [/gdscript] [csharp] var prefix = "$DOCS_URL/?highlight="; var url = prefix + "Godot Engine:docs".URIEncode();

GD.Print(url); // Prints "$DOCS_URL/?highlight=Godot%20Engine%3%docs" [/csharp] [/codeblocks]

func (StringName) ValidateFilename

func (self StringName) ValidateFilename(ctx Lifetime) String

Returns a copy of the string with all characters that are not allowed in [method is_valid_filename] replaced with underscores.

func (StringName) ValidateNodeName

func (self StringName) ValidateNodeName(ctx Lifetime) String

Returns a copy of the string with all characters that are not allowed in [member Node.name] ([code].[/code] [code]:[/code] [code]@[/code] [code]/[/code] [code]"[/code] [code]%[/code]) replaced with underscores.

func (StringName) XmlEscape

func (self StringName) XmlEscape(ctx Lifetime, escape_quotes bool) String

Returns a copy of the string with special characters escaped using the XML standard. If [param escape_quotes] is [code]true[/code], the single quote ([code]'[/code]) and double quote ([code]"[/code]) characters are also escaped.

func (StringName) XmlUnescape

func (self StringName) XmlUnescape(ctx Lifetime) String

Returns a copy of the string with escaped characters replaced by their meanings according to the XML standard.

type StringNamePtr

type StringNamePtr *uintptr

type StringPtr

type StringPtr *uintptr

type Transform2D

type Transform2D = xy.Transform2D

type Transform3D

type Transform3D = xy.Transform3D

type TypedArray

type TypedArray[T any] Array

func (TypedArray[T]) All

func (a TypedArray[T]) All(method Callable) bool

func (TypedArray[T]) Any

func (a TypedArray[T]) Any(method Callable) bool

func (TypedArray[T]) Append

func (a TypedArray[T]) Append(value T)

func (TypedArray[T]) AppendArray

func (a TypedArray[T]) AppendArray(array ArrayOf[T])

func (TypedArray[T]) Array

func (a TypedArray[T]) Array() Array

func (TypedArray[T]) Assign

func (a TypedArray[T]) Assign(array ArrayOf[T])

func (TypedArray[T]) Back

func (a TypedArray[T]) Back(tmp Lifetime) T

func (TypedArray[T]) Bsearch

func (a TypedArray[T]) Bsearch(value T, before bool) int64

func (TypedArray[T]) BsearchCustom

func (a TypedArray[T]) BsearchCustom(value T, fn Callable, before bool) int64

func (TypedArray[T]) Clear

func (a TypedArray[T]) Clear()

func (TypedArray[T]) Count

func (a TypedArray[T]) Count(value T) int64

func (TypedArray[T]) Duplicate

func (a TypedArray[T]) Duplicate(ctx Lifetime, deep bool) ArrayOf[T]

func (TypedArray[T]) Erase

func (a TypedArray[T]) Erase(value T)

func (TypedArray[T]) Fill

func (a TypedArray[T]) Fill(value T)

func (TypedArray[T]) Filter

func (a TypedArray[T]) Filter(ctx Lifetime, method Callable) ArrayOf[T]

func (TypedArray[T]) Find

func (a TypedArray[T]) Find(what T, from int64) int64

func (TypedArray[T]) Free

func (a TypedArray[T]) Free()

func (TypedArray[T]) Front

func (a TypedArray[T]) Front(ctx Lifetime) T

func (TypedArray[T]) GetTypedBuiltin

func (a TypedArray[T]) GetTypedBuiltin() int64

func (TypedArray[T]) GetTypedClassName

func (a TypedArray[T]) GetTypedClassName(ctx Lifetime) StringName

func (TypedArray[T]) GetTypedScript

func (a TypedArray[T]) GetTypedScript(ctx Lifetime) Variant

func (TypedArray[T]) Has

func (a TypedArray[T]) Has(value T) bool

func (TypedArray[T]) Hash

func (a TypedArray[T]) Hash() int64

func (TypedArray[T]) Index

func (a TypedArray[T]) Index(ctx Lifetime, index int64) T

func (TypedArray[T]) Insert

func (a TypedArray[T]) Insert(position int64, value T) int64

func (TypedArray[T]) IsEmpty

func (a TypedArray[T]) IsEmpty() bool

func (TypedArray[T]) IsReadOnly

func (a TypedArray[T]) IsReadOnly() bool

func (TypedArray[T]) IsSameTyped

func (a TypedArray[T]) IsSameTyped(array Array) bool

func (TypedArray[T]) IsTyped

func (a TypedArray[T]) IsTyped() bool

func (TypedArray[T]) Iter

func (a TypedArray[T]) Iter() iter.Seq2[Int, T]

func (TypedArray[T]) MakeReadOnly

func (a TypedArray[T]) MakeReadOnly()

func (TypedArray[T]) Map

func (a TypedArray[T]) Map(ctx Lifetime, method Callable) ArrayOf[T]

func (TypedArray[T]) Max

func (a TypedArray[T]) Max(ctx Lifetime) T

func (TypedArray[T]) Min

func (a TypedArray[T]) Min(ctx Lifetime) T

func (TypedArray[T]) PickRandom

func (a TypedArray[T]) PickRandom(ctx Lifetime) T

func (TypedArray[T]) PopAt

func (a TypedArray[T]) PopAt(ctx Lifetime, position int64) T

func (TypedArray[T]) PopBack

func (a TypedArray[T]) PopBack(ctx Lifetime) T

func (TypedArray[T]) PopFront

func (a TypedArray[T]) PopFront(ctx Lifetime) T

func (TypedArray[T]) PushBack

func (a TypedArray[T]) PushBack(value T)

func (TypedArray[T]) PushFront

func (a TypedArray[T]) PushFront(value T)

func (TypedArray[T]) Reduce

func (a TypedArray[T]) Reduce(ctx Lifetime, method Callable, accum T) T

func (TypedArray[T]) RemoveAt

func (a TypedArray[T]) RemoveAt(position int64)

func (TypedArray[T]) Resize

func (a TypedArray[T]) Resize(size int64) int64

func (TypedArray[T]) Reverse

func (a TypedArray[T]) Reverse()

func (TypedArray[T]) Rfind

func (a TypedArray[T]) Rfind(what T, from int64) int64

func (TypedArray[T]) SetIndex

func (a TypedArray[T]) SetIndex(index int64, value T)

func (TypedArray[T]) Shuffle

func (a TypedArray[T]) Shuffle()

func (TypedArray[T]) Size

func (a TypedArray[T]) Size() int64

func (TypedArray[T]) Slice

func (a TypedArray[T]) Slice(ctx Lifetime, begin int64, end int64, step int64, deep bool) ArrayOf[T]

func (TypedArray[T]) Sort

func (a TypedArray[T]) Sort()

func (TypedArray[T]) SortCustom

func (a TypedArray[T]) SortCustom(fn Callable)

func (TypedArray[T]) Typed

func (a TypedArray[T]) Typed(TypedArray[T])

func (TypedArray[T]) UnmarshalInto

func (a TypedArray[T]) UnmarshalInto(val any) error

type UnsafeArgs

type UnsafeArgs unsafe.Pointer

type UnsafeBack

type UnsafeBack unsafe.Pointer

type Variant

type Variant mmm.Pointer[API, Variant, [3]uintptr]

func (Variant) AABB

func (variant Variant) AABB() AABB

AABB returns the variant as an AABB. Panics if the variant is not an AABB.

func (Variant) Add

func (variant Variant) Add(ctx Lifetime, other Variant) Variant

func (Variant) AtLeast

func (variant Variant) AtLeast(ctx Lifetime, other Variant) bool

func (Variant) AtMost

func (variant Variant) AtMost(ctx Lifetime, other Variant) bool

func (Variant) Basis

func (variant Variant) Basis() Basis

Basis returns the variant as a Basis. Panics if the variant is not a Basis.

func (Variant) BitAnd

func (variant Variant) BitAnd(ctx Lifetime, other Variant) Variant

func (Variant) BitNegate

func (variant Variant) BitNegate(ctx Lifetime) Variant

func (Variant) BitOr

func (variant Variant) BitOr(ctx Lifetime, other Variant) Variant

func (Variant) BitXor

func (variant Variant) BitXor(ctx Lifetime, other Variant) Variant

func (Variant) Bool

func (variant Variant) Bool() Bool

Bool returns the variant as a bool. Panics if the variant is not a bool.

func (Variant) Call

func (variant Variant) Call(ctx Lifetime, method StringName, args ...Variant) (Variant, error)

Call calls a method on the variant dynamically.

func (Variant) Color

func (variant Variant) Color() Color

Color returns the variant as a Color. Panics if the variant is not a Color.

func (Variant) Copy

func (variant Variant) Copy(ctx Lifetime) Variant

Copy returns a copy of the variant that will belong to the provided context.

func (Variant) Divide

func (variant Variant) Divide(ctx Lifetime, other Variant) Variant

func (Variant) EqualTo

func (variant Variant) EqualTo(ctx Lifetime, other Variant) bool

func (Variant) Float

func (variant Variant) Float() Float

Float returns the variant as a float. Panics if the variant is not a float.

func (Variant) Free

func (s Variant) Free()

func (Variant) Get

func (variant Variant) Get(ctx Lifetime, key Variant) (val Variant, ok bool)

Get returns the value specified by the given key variant and a boolean indiciating whether the get operation was valid.

func (Variant) Hash

func (variant Variant) Hash() Int

Hash returns the hash value of the variant.

func (Variant) In

func (variant Variant) In(ctx Lifetime, other Variant) Variant

func (Variant) Int

func (variant Variant) Int() Int

Int returns the variant as an int. Panics if the variant is not an int.

func (Variant) Interface

func (variant Variant) Interface(ctx Lifetime) any

Interface returns the variant's value as one of the the native Godot values (as defined) in the gd package.

func (Variant) Iterator

func (variant Variant) Iterator(ctx Lifetime) Iterator

Iterator returns an iterator for the variant.

func (Variant) LessThan

func (variant Variant) LessThan(ctx Lifetime, other Variant) bool

func (Variant) LogicalAnd

func (variant Variant) LogicalAnd(ctx Lifetime, other Variant) Variant

func (Variant) LogicalNegate

func (variant Variant) LogicalNegate(ctx Lifetime) Variant

func (Variant) LogicalOr

func (variant Variant) LogicalOr(ctx Lifetime, other Variant) Variant

func (Variant) LogicalXor

func (variant Variant) LogicalXor(ctx Lifetime, other Variant) Variant

func (Variant) Modulo

func (variant Variant) Modulo(ctx Lifetime, other Variant) Variant

func (Variant) MoreThan

func (variant Variant) MoreThan(ctx Lifetime, other Variant) bool

func (Variant) Multiply

func (variant Variant) Multiply(ctx Lifetime, other Variant) Variant

func (Variant) Negate

func (variant Variant) Negate(ctx Lifetime) Variant

func (Variant) NotEqualTo

func (variant Variant) NotEqualTo(ctx Lifetime, other Variant) bool

func (Variant) Plane

func (variant Variant) Plane() Plane

Plane returns the variant as a Plane. Panics if the variant is not a Plane.

func (Variant) Positive

func (variant Variant) Positive(ctx Lifetime) Variant

func (Variant) Power

func (variant Variant) Power(ctx Lifetime, other Variant) Variant

func (Variant) Projection

func (variant Variant) Projection() Projection

Projection returns the variant as a Projection. Panics if the variant is not a Projection.

func (Variant) Quaternion

func (variant Variant) Quaternion() Quaternion

Quaternion returns the variant as a Quaternion. Panics if the variant is not a Quaternion.

func (Variant) Rect2

func (variant Variant) Rect2() Rect2

Rect2 returns the variant as a Rect2. Panics if the variant is not a Rect2.

func (Variant) Rect2i

func (variant Variant) Rect2i() Rect2i

Rect2i returns the variant as a Rect2i. Panics if the variant is not a Rect2i.

func (Variant) RecursiveHash

func (variant Variant) RecursiveHash(count Int) Int

RecursiveHash returns the hash value of the variant recursively.

func (Variant) Set

func (variant Variant) Set(key, val Variant) bool

Set sets the value specified by the given key variant to the given value variant. Returns true if the set operation was valid.

func (Variant) ShiftLeft

func (variant Variant) ShiftLeft(ctx Lifetime, other Variant) Variant

func (Variant) ShiftRight

func (variant Variant) ShiftRight(ctx Lifetime, other Variant) Variant

func (Variant) Subtract

func (variant Variant) Subtract(ctx Lifetime, other Variant) Variant

func (Variant) Transform2D

func (variant Variant) Transform2D() Transform2D

Transform2D returns the variant as a Transform2D. Panics if the variant is not a Transform2D.

func (Variant) Transform3D

func (variant Variant) Transform3D() Transform3D

Transform3D returns the variant as a Transform3D. Panics if the variant is not a Transform3D.

func (Variant) Type

func (variant Variant) Type() VariantType

Type returns the variant's type, similar to reflect.Kind but for a variant value.

func (Variant) Vector2

func (variant Variant) Vector2() Vector2

Vector2 returns the variant as a Vector2. Panics if the variant is not a Vector2.

func (Variant) Vector2i

func (variant Variant) Vector2i() Vector2i

Vector2i returns the variant as a Vector2i. Panics if the variant is not a Vector2i.

func (Variant) Vector3

func (variant Variant) Vector3() Vector3

Vector3 returns the variant as a Vector3. Panics if the variant is not a Vector3.

func (Variant) Vector3i

func (variant Variant) Vector3i() Vector3i

Vector3i returns the variant as a Vector3i. Panics if the variant is not a Vector3i.

func (Variant) Vector4

func (variant Variant) Vector4() Vector4

Vector4 returns the variant as a Vector4. Panics if the variant is not a Vector4.

func (Variant) Vector4i

func (variant Variant) Vector4i() Vector4i

Vector4i returns the variant as a Vector4i. Panics if the variant is not a Vector4i.

type VariantOperator

type VariantOperator int64

type VariantPtr

type VariantPtr *[3]uintptr

type VariantType

type VariantType int64
const (
	/*Variable is [code]null[/code].*/
	TypeNil VariantType = 0
	/*Variable is of type [bool].*/
	TypeBool VariantType = 1
	/*Variable is of type [int].*/
	TypeInt VariantType = 2
	/*Variable is of type [float].*/
	TypeFloat VariantType = 3
	/*Variable is of type [String].*/
	TypeString VariantType = 4
	/*Variable is of type [Vector2].*/
	TypeVector2 VariantType = 5
	/*Variable is of type [Vector2i].*/
	TypeVector2i VariantType = 6
	/*Variable is of type [Rect2].*/
	TypeRect2 VariantType = 7
	/*Variable is of type [Rect2i].*/
	TypeRect2i VariantType = 8
	/*Variable is of type [Vector3].*/
	TypeVector3 VariantType = 9
	/*Variable is of type [Vector3i].*/
	TypeVector3i VariantType = 10
	/*Variable is of type [Transform2D].*/
	TypeTransform2d VariantType = 11
	/*Variable is of type [Vector4].*/
	TypeVector4 VariantType = 12
	/*Variable is of type [Vector4i].*/
	TypeVector4i VariantType = 13
	/*Variable is of type [Plane].*/
	TypePlane VariantType = 14
	/*Variable is of type [Quaternion].*/
	TypeQuaternion VariantType = 15
	/*Variable is of type [AABB].*/
	TypeAabb VariantType = 16
	/*Variable is of type [Basis].*/
	TypeBasis VariantType = 17
	/*Variable is of type [Transform3D].*/
	TypeTransform3d VariantType = 18
	/*Variable is of type [Projection].*/
	TypeProjection VariantType = 19
	/*Variable is of type [Color].*/
	TypeColor VariantType = 20
	/*Variable is of type [StringName].*/
	TypeStringName VariantType = 21
	/*Variable is of type [NodePath].*/
	TypeNodePath VariantType = 22
	/*Variable is of type [RID].*/
	TypeRid VariantType = 23
	/*Variable is of type [Object].*/
	TypeObject VariantType = 24
	/*Variable is of type [Callable].*/
	TypeCallable VariantType = 25
	/*Variable is of type [Signal].*/
	TypeSignal VariantType = 26
	/*Variable is of type [Dictionary].*/
	TypeDictionary VariantType = 27
	/*Variable is of type [Array].*/
	TypeArray VariantType = 28
	/*Variable is of type [PackedByteArray].*/
	TypePackedByteArray VariantType = 29
	/*Variable is of type [PackedInt32Array].*/
	TypePackedInt32Array VariantType = 30
	/*Variable is of type [PackedInt64Array].*/
	TypePackedInt64Array VariantType = 31
	/*Variable is of type [PackedFloat32Array].*/
	TypePackedFloat32Array VariantType = 32
	/*Variable is of type [PackedFloat64Array].*/
	TypePackedFloat64Array VariantType = 33
	/*Variable is of type [PackedStringArray].*/
	TypePackedStringArray VariantType = 34
	/*Variable is of type [PackedVector2Array].*/
	TypePackedVector2Array VariantType = 35
	/*Variable is of type [PackedVector3Array].*/
	TypePackedVector3Array VariantType = 36
	/*Variable is of type [PackedColorArray].*/
	TypePackedColorArray VariantType = 37
	/*Variable is of type [PackedVector4Array].*/
	TypePackedVector4Array VariantType = 38
	/*Represents the size of the [enum Variant.Type] enum.*/
	TypeMax VariantType = 39
)

func (VariantType) Call

func (variant VariantType) Call(ctx Lifetime, method StringName, args ...Variant) (Variant, error)

Call a static method on a variant type.

func (VariantType) New

func (variant VariantType) New(ctx Lifetime, args ...Variant) (Variant, error)

New calls the variant constructor with the given arguments and returns the result as a variant.

type Vector2

type Vector2 = xy.Vector2

type Vector2Axis

type Vector2Axis int64

type Vector2i

type Vector2i = xy.Vector2i

type Vector2iAxis

type Vector2iAxis int64

type Vector3

type Vector3 = xy.Vector3

type Vector3Axis

type Vector3Axis int64

type Vector3i

type Vector3i = xy.Vector3i

type Vector3iAxis

type Vector3iAxis int64

type Vector4

type Vector4 = xy.Vector4

type Vector4Axis

type Vector4Axis int64

type Vector4i

type Vector4i = xy.Vector4i

type Vector4iAxis

type Vector4iAxis int64

type Version

type Version struct {
	Major uint32
	Minor uint32
	Patch uint32
	Value string
}

func (Version) String

func (v Version) String() string

type VerticalAlignment

type VerticalAlignment int64

Directories

Path Synopsis
Package callframe provides a way to create Godot-compatible callframes.
Package callframe provides a way to create Godot-compatible callframes.
Code generated by the generate package DO NOT EDIT
Code generated by the generate package DO NOT EDIT
tool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL