Documentation ¶
Overview ¶
Code generated by the generate package DO NOT EDIT
Code generated by the generate package DO NOT EDIT
Index ¶
- Variables
- func ArrayAs[S []T, T any](array Array) []T
- func ArrayFromSlice[T ArrayVariant.Contains[A], A, B any](slice []B) T
- func As[T IsClass](class IsClass) (T, bool)
- func Cleanups() []func()
- func ConvertToDesiredGoType(value any, rtype reflect.Type) (reflect.Value, error)
- func DictionaryAs[T any](dictionary DictionaryType.Any) T
- func DictionaryFromMap[T any](val T) DictionaryType.Any
- func EngineArrayFromSlice(slice []any) ArrayVariant.Any
- func GetLibraryPath() string
- func InternalPacked[P Packed[P, V], V PackedType.Type](array PackedType.Array[V]) P
- func LetVariantAsPointerType[T pointers.Generic[T, Size], Size pointers.Size](variant Variant, vtype VariantType) T
- func NewSignalCheck(SignalProxy, complex128) bool
- func NodePathCheck(_ NodePathProxy, raw complex128) bool
- func PointerBorrowedTemporarily[T pointers.Generic[T, [3]uint64]](ptr EnginePointer) T
- func PointerLifetimeBoundTo[T pointers.Generic[T, [3]uint64]](obj [1]Object, ptr EnginePointer) T
- func PointerMustAssertInstanceID[T pointers.Generic[T, [3]uint64]](ptr EnginePointer) T
- func PointerWithOwnershipTransferredToGo[T pointers.Generic[T, [3]uint64]](ptr EnginePointer) T
- func Print(arg1 Variant, args ...Variant)
- func PrintRich(arg1 Variant, args ...Variant)
- func PrintVerbose(arg1 Variant, args ...Variant)
- func Printerr(arg1 Variant, args ...Variant)
- func Printraw(arg1 Variant, args ...Variant)
- func Prints(arg1 Variant, args ...Variant)
- func Printt(arg1 Variant, args ...Variant)
- func PushError(arg1 Variant, args ...Variant)
- func PushWarning(arg1 Variant, args ...Variant)
- func Randomize()
- func Recover()
- func RegisterCleanup(f func())
- func Seed(base Int)
- func SetSignal(signal IsSignal, val Signal)
- func StringCacheCheck(_ StringProxy, raw complex128) bool
- func StringNameCheck(_ StringNameProxy, raw complex128) bool
- func ToError(err Error) error
- func UnsafeGet[T any](frame Address, index int) T
- func UnsafeSet[T any](frame Address, value T)
- func VariantAs[T any](value Variant) T
- func VirtualByName(class IsClass, name string) reflect.Value
- type AABB
- type API
- type Address
- type Array
- func (self Array) All(method Callable) Bool
- func (self Array) Any(method Callable) Bool
- func (self Array) Append(value Variant)
- func (self Array) AppendArray(array Array)
- func (self Array) Assign(array Array)
- func (self Array) Back() Variant
- func (self Array) Bsearch(value Variant, before Bool) Int
- func (self Array) BsearchCustom(value Variant, fn Callable, before Bool) Int
- func (self Array) Clear()
- func (self Array) Count(value Variant) Int
- func (self Array) Duplicate(deep Bool) Array
- func (self Array) Erase(value Variant)
- func (self Array) Fill(value Variant)
- func (self Array) Filter(method Callable) Array
- func (self Array) Find(what Variant, from Int) Int
- func (a Array) Free()
- func (self Array) Front() Variant
- func (self Array) GetTypedBuiltin() Int
- func (self Array) GetTypedClassName() StringName
- func (self Array) GetTypedScript() Variant
- func (self Array) Has(value Variant) Bool
- func (self Array) Hash() Int
- func (a Array) Index(index Int) Variant
- func (self Array) Insert(position Int, value Variant) Int
- func (self Array) IsEmpty() Bool
- func (self Array) IsReadOnly() Bool
- func (self Array) IsSameTyped(array Array) Bool
- func (self Array) IsTyped() Bool
- func (a Array) Iter() iter.Seq2[Int, Variant]
- func (self Array) MakeReadOnly()
- func (self Array) Map(method Callable) Array
- func (self Array) Max() Variant
- func (self Array) Min() Variant
- func (self Array) PickRandom() Variant
- func (self Array) PopAt(position Int) Variant
- func (self Array) PopBack() Variant
- func (self Array) PopFront() Variant
- func (self Array) PushBack(value Variant)
- func (self Array) PushFront(value Variant)
- func (self Array) Reduce(method Callable, accum Variant) Variant
- func (self Array) RemoveAt(position Int)
- func (self Array) Resize(size Int) Int
- func (self Array) Reverse()
- func (self Array) Rfind(what Variant, from Int) Int
- func (a Array) SetIndex(index Int, value Variant)
- func (self Array) Shuffle()
- func (self Array) Size() Int
- func (self Array) Slice(begin Int, end Int, step Int, deep Bool) Array
- func (self Array) Sort()
- func (self Array) SortCustom(fn Callable)
- type ArrayProxy
- func (ArrayProxy[T]) Any(state complex128) ArrayVariant.Any
- func (ArrayProxy[T]) Index(state complex128, i int) T
- func (ArrayProxy[T]) IsReadOnly(state complex128) bool
- func (ArrayProxy[T]) Len(state complex128) int
- func (ArrayProxy[T]) MakeReadOnly(state complex128)
- func (ArrayProxy[T]) Resize(state complex128, i int)
- func (ArrayProxy[T]) SetIndex(state complex128, i int, val T)
- type AudioFrame
- type Basis
- type Bool
- type CallError
- type CallErrorType
- type Callable
- func (self Callable) Bind(args ...Variant) Callable
- func (self Callable) Bindv(arguments Array) Callable
- func (self Callable) Call(args ...Variant) Variant
- func (self Callable) CallDeferred(args ...Variant)
- func (self Callable) Callv(arguments Array) Variant
- func (self Callable) Create(variant Variant, method StringName) Callable
- func (c Callable) Free()
- func (self Callable) GetArgumentCount() Int
- func (self Callable) GetBoundArguments() Array
- func (self Callable) GetBoundArgumentsCount() Int
- func (self Callable) GetMethod() StringName
- func (self Callable) GetObject() Object
- func (self Callable) GetObjectId() Int
- func (self Callable) Hash() Int
- func (self Callable) IsCustom() Bool
- func (self Callable) IsNull() Bool
- func (self Callable) IsStandard() Bool
- func (self Callable) IsValid() Bool
- func (self Callable) Rpc(args ...Variant)
- func (self Callable) RpcId(peer_id Int, args ...Variant)
- func (self Callable) Unbind(argcount Int) Callable
- type CallableProxy
- func (CallableProxy) Args(state complex128) (args int, bind ArrayType.Any)
- func (CallableProxy) Bind(state complex128, args ...VariantPkg.Any) (CallableType.Proxy, complex128)
- func (CallableProxy) Call(state complex128, args ...VariantPkg.Any) VariantPkg.Any
- func (CallableProxy) Name(state complex128) string
- type CaretInfo
- type Class
- type ClassInterface
- type ClassMethodArgumentMetadata
- type ClassTag
- type Color
- type Dictionary
- func (self Dictionary) Clear()
- func (self Dictionary) Duplicate(deep Bool) Dictionary
- func (self Dictionary) Erase(key Variant) Bool
- func (self Dictionary) FindKey(value Variant) Variant
- func (d Dictionary) Free()
- func (self Dictionary) Get(key Variant, def Variant) Variant
- func (self Dictionary) GetOrAdd(key Variant, def Variant) Variant
- func (self Dictionary) Has(key Variant) Bool
- func (self Dictionary) HasAll(keys Array) Bool
- func (self Dictionary) Hash() Int
- func (d Dictionary) Index(key Variant) Variant
- func (self Dictionary) IsEmpty() Bool
- func (self Dictionary) IsReadOnly() Bool
- func (self Dictionary) Keys() Array
- func (self Dictionary) MakeReadOnly()
- func (self Dictionary) Merge(dictionary Dictionary, overwrite Bool)
- func (self Dictionary) Merged(dictionary Dictionary, overwrite Bool) Dictionary
- func (self Dictionary) RecursiveEqual(dictionary Dictionary, recursion_count Int) Bool
- func (d Dictionary) SetIndex(key Variant, value Variant)
- func (self Dictionary) Size() Int
- func (self Dictionary) Values() Array
- type DictionaryProxy
- func (DictionaryProxy[K, V]) Any(state complex128) DictionaryType.Any
- func (DictionaryProxy[K, V]) Clear(state complex128)
- func (DictionaryProxy[K, V]) Erase(state complex128, key K) bool
- func (DictionaryProxy[K, V]) Has(state complex128, key K) bool
- func (DictionaryProxy[K, V]) Hash(state complex128) uint32
- func (DictionaryProxy[K, V]) Index(state complex128, key K) V
- func (DictionaryProxy[K, V]) IsReadOnly(state complex128) bool
- func (DictionaryProxy[K, V]) Iter(state complex128) iter.Seq2[K, V]
- func (DictionaryProxy[K, V]) Len(state complex128) int
- func (DictionaryProxy[K, V]) Lookup(state complex128, key K) (V, bool)
- func (DictionaryProxy[K, V]) MakeReadOnly(state complex128)
- func (DictionaryProxy[K, V]) SetIndex(state complex128, key K, val V)
- type EnginePointer
- type Error
- type Extends
- type ExtensionClassCallVirtualFunc
- type ExtensionToken
- type Float
- func Absf(x Float) Float
- func Acos(x Float) Float
- func Acosh(x Float) Float
- func AngleDifference(from Float, to Float) Float
- func Asin(x Float) Float
- func Asinh(x Float) Float
- func Atan(x Float) Float
- func Atan2(y Float, x Float) Float
- func Atanh(x Float) Float
- func BezierDerivative(start Float, control_1 Float, control_2 Float, end Float, t Float) Float
- func BezierInterpolate(start Float, control_1 Float, control_2 Float, end Float, t Float) Float
- func Ceilf(x Float) Float
- func Clampf(value Float, min Float, max Float) Float
- func Cos(angle_rad Float) Float
- func Cosh(x Float) Float
- func CubicInterpolate(from Float, to Float, pre Float, post Float, weight Float) Float
- func CubicInterpolateAngle(from Float, to Float, pre Float, post Float, weight Float) Float
- func CubicInterpolateAngleInTime(from Float, to Float, pre Float, post Float, weight Float, to_t Float, ...) Float
- func CubicInterpolateInTime(from Float, to Float, pre Float, post Float, weight Float, to_t Float, ...) Float
- func DbToLinear(db Float) Float
- func DegToRad(deg Float) Float
- func Ease(x Float, curve Float) Float
- func Exp(x Float) Float
- func Floorf(x Float) Float
- func Fmod(x Float, y Float) Float
- func Fposmod(x Float, y Float) Float
- func InverseLerp(from Float, to Float, weight Float) Float
- func LerpAngle(from Float, to Float, weight Float) Float
- func Lerpf(from Float, to Float, weight Float) Float
- func LinearToDb(lin Float) Float
- func Log(x Float) Float
- func Maxf(a Float, b Float) Float
- func Minf(a Float, b Float) Float
- func MoveToward(from Float, to Float, delta Float) Float
- func Pingpong(value Float, length Float) Float
- func Pow(base Float, exp Float) Float
- func RadToDeg(rad Float) Float
- func Randf() Float
- func RandfRange(from Float, to Float) Float
- func Randfn(mean Float, deviation Float) Float
- func Remap(value Float, istart Float, istop Float, ostart Float, ostop Float) Float
- func RotateToward(from Float, to Float, delta Float) Float
- func Roundf(x Float) Float
- func Signf(x Float) Float
- func Sin(angle_rad Float) Float
- func Sinh(x Float) Float
- func Smoothstep(from Float, to Float, x Float) Float
- func Snappedf(x Float, step Float) Float
- func Sqrt(x Float) Float
- func Tan(angle_rad Float) Float
- func Tanh(x Float) Float
- func Wrapf(value Float, min Float, max Float) Float
- type GDExtensionInitializationLevel
- type Glyph
- type InstanceBindingType
- type InstanceID
- type Int
- func Absi(x Int) Int
- func Ceili(x Float) Int
- func Clampi(value Int, min Int, max Int) Int
- func Floori(x Float) Int
- func Hash(variable Variant) Int
- func Maxi(a Int, b Int) Int
- func Mini(a Int, b Int) Int
- func NearestPo2(value Int) Int
- func Posmod(x Int, y Int) Int
- func Randi() Int
- func RandiRange(from Int, to Int) Int
- func RidAllocateId() Int
- func Roundi(x Float) Int
- func Signi(x Int) Int
- func Snappedi(x Float, step Int) Int
- func StepDecimals(x Float) Int
- func Typeof(variable Variant) Int
- func Wrapi(value Int, min Int, max Int) Int
- type IsClass
- type IsSignal
- type Iterator
- type Method
- type MethodBind
- type MethodFlags
- type MethodInfo
- type NodePath
- func (n NodePath) Free()
- func (self NodePath) GetAsPropertyPath() NodePath
- func (self NodePath) GetConcatenatedNames() StringName
- func (self NodePath) GetConcatenatedSubnames() StringName
- func (self NodePath) GetName(idx Int) StringName
- func (self NodePath) GetNameCount() Int
- func (self NodePath) GetSubname(idx Int) StringName
- func (self NodePath) GetSubnameCount() Int
- func (self NodePath) Hash() Int
- func (n NodePath) InternalString() String
- func (self NodePath) IsAbsolute() Bool
- func (self NodePath) IsEmpty() Bool
- func (self NodePath) Slice(begin Int, end Int) NodePath
- func (n NodePath) String() string
- type NodePathProxy
- func (NodePathProxy) AppendOther(raw complex128, api StringType.API, raw2 complex128) StringType.Readable
- func (NodePathProxy) AppendRune(raw complex128, r StringType.Rune) StringType.Readable
- func (NodePathProxy) AppendString(raw complex128, str string) StringType.Readable
- func (NodePathProxy) DecodeRune(raw complex128) (StringType.Rune, int, StringType.Readable)
- func (NodePathProxy) Index(raw complex128, n int) byte
- func (NodePathProxy) Len(raw complex128) int
- func (NodePathProxy) Slice(raw complex128, index int, close int) StringType.Readable
- func (NodePathProxy) String(raw complex128) string
- type NotificationType
- type Object
- func (self Object) AddUserSignal(signal String, arguments Array)
- func (self Object) AsObject() [1]Object
- func (self Object) Callv(method StringName, arg_array Array) Variant
- func (self Object) CanTranslateMessages() Bool
- func (self Object) CancelFree()
- func (self Object) Connect(signal StringName, callable Callable, flags Int) int64
- func (self Object) Disconnect(signal StringName, callable Callable)
- func (self Object) Free()
- func (self Object) Get(property StringName) Variant
- func (self Object) GetClass() String
- func (self Object) GetIncomingConnections() Array
- func (self Object) GetIndexed(property_path NodePath) Variant
- func (self Object) GetInstanceId() Int
- func (self Object) GetMeta(name StringName, def Variant) Variant
- func (self Object) GetMetaList() Array
- func (self Object) GetMethodArgumentCount(method StringName) Int
- func (self Object) GetMethodList() Array
- func (self Object) GetPropertyList() Array
- func (self Object) GetScript() Variant
- func (self Object) GetSignalConnectionList(signal StringName) Array
- func (self Object) GetSignalList() Array
- func (self Object) HasMeta(name StringName) Bool
- func (self Object) HasMethod(method StringName) Bool
- func (self Object) HasSignal(signal StringName) Bool
- func (self Object) HasUserSignal(signal StringName) Bool
- func (self Object) IsBlockingSignals() Bool
- func (self Object) IsClass(class String) Bool
- func (self Object) IsConnected(signal StringName, callable Callable) Bool
- func (self Object) IsQueuedForDeletion() Bool
- func (self Object) Notification(what Int, reversed Bool)
- func (self Object) NotifyPropertyListChanged()
- func (self Object) PropertyCanRevert(property StringName) Bool
- func (self Object) PropertyGetRevert(property StringName) Variant
- func (self Object) RemoveMeta(name StringName)
- func (self Object) RemoveUserSignal(signal StringName)
- func (self Object) Set(property StringName, value Variant)
- func (self Object) SetBlockSignals(enable Bool)
- func (self Object) SetDeferred(property StringName, value Variant)
- func (self Object) SetIndexed(property_path NodePath, value Variant)
- func (self Object) SetMessageTranslation(enable Bool)
- func (self Object) SetMeta(name StringName, value Variant)
- func (self Object) SetScript(script Variant)
- func (self Object) ToString() String
- func (self Object) Tr(message StringName, context StringName) String
- func (self Object) TrN(message StringName, plural_message StringName, n Int, context StringName) String
- func (self Object) Virtual(name string) reflect.Value
- type ObjectConnectFlags
- type ObjectID
- type ObjectInterface
- type Operator
- type Packed
- type PackedByteArray
- func (self PackedByteArray) Append(value Int) Bool
- func (self PackedByteArray) AppendArray(array PackedByteArray)
- func (self PackedByteArray) Bsearch(value Int, before Bool) Int
- func (p PackedByteArray) Bytes() []byte
- func (p PackedByteArray) Cap() int
- func (self PackedByteArray) Clear()
- func (self PackedByteArray) Compress(compression_mode Int) PackedByteArray
- func (self PackedByteArray) Count(value Int) Int
- func (self PackedByteArray) DecodeDouble(byte_offset Int) Float
- func (self PackedByteArray) DecodeFloat(byte_offset Int) Float
- func (self PackedByteArray) DecodeHalf(byte_offset Int) Float
- func (self PackedByteArray) DecodeS16(byte_offset Int) Int
- func (self PackedByteArray) DecodeS32(byte_offset Int) Int
- func (self PackedByteArray) DecodeS64(byte_offset Int) Int
- func (self PackedByteArray) DecodeS8(byte_offset Int) Int
- func (self PackedByteArray) DecodeU16(byte_offset Int) Int
- func (self PackedByteArray) DecodeU32(byte_offset Int) Int
- func (self PackedByteArray) DecodeU64(byte_offset Int) Int
- func (self PackedByteArray) DecodeU8(byte_offset Int) Int
- func (self PackedByteArray) DecodeVar(byte_offset Int, allow_objects Bool) Variant
- func (self PackedByteArray) DecodeVarSize(byte_offset Int, allow_objects Bool) Int
- func (self PackedByteArray) Decompress(buffer_size Int, compression_mode Int) PackedByteArray
- func (self PackedByteArray) DecompressDynamic(max_output_size Int, compression_mode Int) PackedByteArray
- func (self PackedByteArray) Duplicate() PackedByteArray
- func (self PackedByteArray) EncodeDouble(byte_offset Int, value Float)
- func (self PackedByteArray) EncodeFloat(byte_offset Int, value Float)
- func (self PackedByteArray) EncodeHalf(byte_offset Int, value Float)
- func (self PackedByteArray) EncodeS16(byte_offset Int, value Int)
- func (self PackedByteArray) EncodeS32(byte_offset Int, value Int)
- func (self PackedByteArray) EncodeS64(byte_offset Int, value Int)
- func (self PackedByteArray) EncodeS8(byte_offset Int, value Int)
- func (self PackedByteArray) EncodeU16(byte_offset Int, value Int)
- func (self PackedByteArray) EncodeU32(byte_offset Int, value Int)
- func (self PackedByteArray) EncodeU64(byte_offset Int, value Int)
- func (self PackedByteArray) EncodeU8(byte_offset Int, value Int)
- func (self PackedByteArray) EncodeVar(byte_offset Int, value Variant, allow_objects Bool) Int
- func (self PackedByteArray) Fill(value Int)
- func (self PackedByteArray) Find(value Int, from Int) Int
- func (p PackedByteArray) Free()
- func (self PackedByteArray) GetStringFromAscii() String
- func (self PackedByteArray) GetStringFromUtf16() String
- func (self PackedByteArray) GetStringFromUtf32() String
- func (self PackedByteArray) GetStringFromUtf8() String
- func (self PackedByteArray) GetStringFromWchar() String
- func (self PackedByteArray) Has(value Int) Bool
- func (self PackedByteArray) HasEncodedVar(byte_offset Int, allow_objects Bool) Bool
- func (self PackedByteArray) HexEncode() String
- func (p PackedByteArray) Index(idx Int) byte
- func (self PackedByteArray) Insert(at_index Int, value Int) Int
- func (self PackedByteArray) IsEmpty() Bool
- func (p PackedByteArray) Len() int
- func (p PackedByteArray) New() PackedByteArray
- func (self PackedByteArray) PushBack(value Int) Bool
- func (self PackedByteArray) RemoveAt(index Int)
- func (self PackedByteArray) Resize(new_size Int) Int
- func (self PackedByteArray) Reverse()
- func (self PackedByteArray) Rfind(value Int, from Int) Int
- func (self PackedByteArray) Set(index Int, value Int)
- func (p PackedByteArray) SetIndex(idx Int, value byte)
- func (self PackedByteArray) Size() Int
- func (self PackedByteArray) Slice(begin Int, end Int) PackedByteArray
- func (self PackedByteArray) Sort()
- func (p PackedByteArray) ToByteArray() PackedByteArray
- func (self PackedByteArray) ToFloat32Array() PackedFloat32Array
- func (self PackedByteArray) ToFloat64Array() PackedFloat64Array
- func (self PackedByteArray) ToInt32Array() PackedInt32Array
- func (self PackedByteArray) ToInt64Array() PackedInt64Array
- type PackedColorArray
- func (self PackedColorArray) Append(value Color) Bool
- func (self PackedColorArray) AppendArray(array PackedColorArray)
- func (p PackedColorArray) AsSlice() []Color
- func (self PackedColorArray) Bsearch(value Color, before Bool) Int
- func (p PackedColorArray) Cap() int
- func (self PackedColorArray) Clear()
- func (self PackedColorArray) Count(value Color) Int
- func (self PackedColorArray) Duplicate() PackedColorArray
- func (self PackedColorArray) Fill(value Color)
- func (self PackedColorArray) Find(value Color, from Int) Int
- func (p PackedColorArray) Free()
- func (self PackedColorArray) Has(value Color) Bool
- func (p PackedColorArray) Index(idx Int) Color
- func (self PackedColorArray) Insert(at_index Int, value Color) Int
- func (self PackedColorArray) IsEmpty() Bool
- func (p PackedColorArray) Len() int
- func (p PackedColorArray) New() PackedColorArray
- func (p *PackedColorArray) Pointer() *PackedColorArray
- func (self PackedColorArray) PushBack(value Color) Bool
- func (self PackedColorArray) RemoveAt(index Int)
- func (self PackedColorArray) Resize(new_size Int) Int
- func (self PackedColorArray) Reverse()
- func (self PackedColorArray) Rfind(value Color, from Int) Int
- func (self PackedColorArray) Set(index Int, value Color)
- func (p PackedColorArray) SetIndex(idx Int, value Color)
- func (self PackedColorArray) Size() Int
- func (self PackedColorArray) Slice(begin Int, end Int) PackedColorArray
- func (self PackedColorArray) Sort()
- func (self PackedColorArray) ToByteArray() PackedByteArray
- type PackedFloat32Array
- func (self PackedFloat32Array) Append(value Float) Bool
- func (self PackedFloat32Array) AppendArray(array PackedFloat32Array)
- func (p PackedFloat32Array) AsSlice() []float32
- func (self PackedFloat32Array) Bsearch(value Float, before Bool) Int
- func (p PackedFloat32Array) Cap() int
- func (self PackedFloat32Array) Clear()
- func (self PackedFloat32Array) Count(value Float) Int
- func (self PackedFloat32Array) Duplicate() PackedFloat32Array
- func (self PackedFloat32Array) Fill(value Float)
- func (self PackedFloat32Array) Find(value Float, from Int) Int
- func (p PackedFloat32Array) Free()
- func (self PackedFloat32Array) Has(value Float) Bool
- func (p PackedFloat32Array) Index(idx Int) float32
- func (self PackedFloat32Array) Insert(at_index Int, value Float) Int
- func (self PackedFloat32Array) IsEmpty() Bool
- func (p PackedFloat32Array) Len() int
- func (p PackedFloat32Array) New() PackedFloat32Array
- func (p *PackedFloat32Array) Pointer() *PackedFloat32Array
- func (self PackedFloat32Array) PushBack(value Float) Bool
- func (self PackedFloat32Array) RemoveAt(index Int)
- func (self PackedFloat32Array) Resize(new_size Int) Int
- func (self PackedFloat32Array) Reverse()
- func (self PackedFloat32Array) Rfind(value Float, from Int) Int
- func (self PackedFloat32Array) Set(index Int, value Float)
- func (p PackedFloat32Array) SetIndex(idx Int, value float32)
- func (self PackedFloat32Array) Size() Int
- func (self PackedFloat32Array) Slice(begin Int, end Int) PackedFloat32Array
- func (self PackedFloat32Array) Sort()
- func (self PackedFloat32Array) ToByteArray() PackedByteArray
- type PackedFloat64Array
- func (self PackedFloat64Array) Append(value Float) Bool
- func (self PackedFloat64Array) AppendArray(array PackedFloat64Array)
- func (p PackedFloat64Array) AsSlice() []float64
- func (self PackedFloat64Array) Bsearch(value Float, before Bool) Int
- func (p PackedFloat64Array) Cap() int
- func (self PackedFloat64Array) Clear()
- func (self PackedFloat64Array) Count(value Float) Int
- func (self PackedFloat64Array) Duplicate() PackedFloat64Array
- func (self PackedFloat64Array) Fill(value Float)
- func (self PackedFloat64Array) Find(value Float, from Int) Int
- func (p PackedFloat64Array) Free()
- func (self PackedFloat64Array) Has(value Float) Bool
- func (p PackedFloat64Array) Index(idx Int) float64
- func (self PackedFloat64Array) Insert(at_index Int, value Float) Int
- func (self PackedFloat64Array) IsEmpty() Bool
- func (p PackedFloat64Array) Len() int
- func (p PackedFloat64Array) New() PackedFloat64Array
- func (p *PackedFloat64Array) Pointer() *PackedFloat64Array
- func (self PackedFloat64Array) PushBack(value Float) Bool
- func (self PackedFloat64Array) RemoveAt(index Int)
- func (self PackedFloat64Array) Resize(new_size Int) Int
- func (self PackedFloat64Array) Reverse()
- func (self PackedFloat64Array) Rfind(value Float, from Int) Int
- func (self PackedFloat64Array) Set(index Int, value Float)
- func (p PackedFloat64Array) SetIndex(idx Int, value float64)
- func (self PackedFloat64Array) Size() Int
- func (self PackedFloat64Array) Slice(begin Int, end Int) PackedFloat64Array
- func (self PackedFloat64Array) Sort()
- func (self PackedFloat64Array) ToByteArray() PackedByteArray
- type PackedFunctionsFor
- type PackedInt32Array
- func (self PackedInt32Array) Append(value Int) Bool
- func (self PackedInt32Array) AppendArray(array PackedInt32Array)
- func (p PackedInt32Array) AsSlice() []int32
- func (self PackedInt32Array) Bsearch(value Int, before Bool) Int
- func (p PackedInt32Array) Cap() int
- func (self PackedInt32Array) Clear()
- func (self PackedInt32Array) Count(value Int) Int
- func (self PackedInt32Array) Duplicate() PackedInt32Array
- func (self PackedInt32Array) Fill(value Int)
- func (self PackedInt32Array) Find(value Int, from Int) Int
- func (p PackedInt32Array) Free()
- func (self PackedInt32Array) Has(value Int) Bool
- func (p PackedInt32Array) Index(idx Int) int32
- func (self PackedInt32Array) Insert(at_index Int, value Int) Int
- func (self PackedInt32Array) IsEmpty() Bool
- func (p PackedInt32Array) Len() int
- func (p PackedInt32Array) New() PackedInt32Array
- func (p *PackedInt32Array) Pointer() *PackedInt32Array
- func (self PackedInt32Array) PushBack(value Int) Bool
- func (self PackedInt32Array) RemoveAt(index Int)
- func (self PackedInt32Array) Resize(new_size Int) Int
- func (self PackedInt32Array) Reverse()
- func (self PackedInt32Array) Rfind(value Int, from Int) Int
- func (self PackedInt32Array) Set(index Int, value Int)
- func (p PackedInt32Array) SetIndex(idx Int, value int32)
- func (self PackedInt32Array) Size() Int
- func (self PackedInt32Array) Slice(begin Int, end Int) PackedInt32Array
- func (self PackedInt32Array) Sort()
- func (self PackedInt32Array) ToByteArray() PackedByteArray
- type PackedInt64Array
- func (self PackedInt64Array) Append(value Int) Bool
- func (self PackedInt64Array) AppendArray(array PackedInt64Array)
- func (p PackedInt64Array) AsSlice() []int64
- func (self PackedInt64Array) Bsearch(value Int, before Bool) Int
- func (p PackedInt64Array) Cap() int
- func (self PackedInt64Array) Clear()
- func (self PackedInt64Array) Count(value Int) Int
- func (self PackedInt64Array) Duplicate() PackedInt64Array
- func (self PackedInt64Array) Fill(value Int)
- func (self PackedInt64Array) Find(value Int, from Int) Int
- func (p PackedInt64Array) Free()
- func (self PackedInt64Array) Has(value Int) Bool
- func (p PackedInt64Array) Index(idx Int) int64
- func (self PackedInt64Array) Insert(at_index Int, value Int) Int
- func (self PackedInt64Array) IsEmpty() Bool
- func (p PackedInt64Array) Len() int
- func (p PackedInt64Array) New() PackedInt64Array
- func (p *PackedInt64Array) Pointer() *PackedInt64Array
- func (self PackedInt64Array) PushBack(value Int) Bool
- func (self PackedInt64Array) RemoveAt(index Int)
- func (self PackedInt64Array) Resize(new_size Int) Int
- func (self PackedInt64Array) Reverse()
- func (self PackedInt64Array) Rfind(value Int, from Int) Int
- func (self PackedInt64Array) Set(index Int, value Int)
- func (p PackedInt64Array) SetIndex(idx Int, value int64)
- func (self PackedInt64Array) Size() Int
- func (self PackedInt64Array) Slice(begin Int, end Int) PackedInt64Array
- func (self PackedInt64Array) Sort()
- func (self PackedInt64Array) ToByteArray() PackedByteArray
- type PackedPointers
- type PackedProxy
- func (PackedProxy[P, V]) Any(raw complex128) ArrayType.Any
- func (PackedProxy[P, V]) Index(raw complex128, i int) V
- func (PackedProxy[P, V]) IsReadOnly(complex128) bool
- func (PackedProxy[P, V]) Len(raw complex128) int
- func (PackedProxy[P, V]) MakeReadOnly(complex128)
- func (PackedProxy[P, V]) Resize(raw complex128, n int)
- func (PackedProxy[P, V]) SetIndex(raw complex128, i int, v V)
- type PackedStringArray
- func (self PackedStringArray) Append(value String) Bool
- func (self PackedStringArray) AppendArray(array PackedStringArray)
- func (p PackedStringArray) AsSlice() []String
- func (self PackedStringArray) Bsearch(value String, before Bool) Int
- func (self PackedStringArray) Clear()
- func (self PackedStringArray) Count(value String) Int
- func (self PackedStringArray) Duplicate() PackedStringArray
- func (self PackedStringArray) Fill(value String)
- func (self PackedStringArray) Find(value String, from Int) Int
- func (p PackedStringArray) Free()
- func (self PackedStringArray) Has(value String) Bool
- func (p PackedStringArray) Index(idx Int) String
- func (self PackedStringArray) Insert(at_index Int, value String) Int
- func (self PackedStringArray) IsEmpty() Bool
- func (p *PackedStringArray) Pointer() *PackedStringArray
- func (self PackedStringArray) PushBack(value String) Bool
- func (self PackedStringArray) RemoveAt(index Int)
- func (self PackedStringArray) Resize(new_size Int) Int
- func (self PackedStringArray) Reverse()
- func (self PackedStringArray) Rfind(value String, from Int) Int
- func (self PackedStringArray) Set(index Int, value String)
- func (p PackedStringArray) SetIndex(idx Int, value String)
- func (self PackedStringArray) Size() Int
- func (self PackedStringArray) Slice(begin Int, end Int) PackedStringArray
- func (self PackedStringArray) Sort()
- func (p PackedStringArray) String() string
- func (p PackedStringArray) Strings() []string
- func (self PackedStringArray) ToByteArray() PackedByteArray
- type PackedStringArrayProxy
- func (PackedStringArrayProxy) Any(raw complex128) ArrayType.Any
- func (PackedStringArrayProxy) Index(raw complex128, i int) StringType.Readable
- func (PackedStringArrayProxy) IsReadOnly(complex128) bool
- func (PackedStringArrayProxy) Len(raw complex128) int
- func (PackedStringArrayProxy) MakeReadOnly(complex128)
- func (PackedStringArrayProxy) Resize(raw complex128, n int)
- func (PackedStringArrayProxy) SetIndex(raw complex128, i int, v StringType.Readable)
- type PackedVector2Array
- func (self PackedVector2Array) Append(value Vector2) Bool
- func (self PackedVector2Array) AppendArray(array PackedVector2Array)
- func (p PackedVector2Array) AsSlice() []Vector2
- func (self PackedVector2Array) Bsearch(value Vector2, before Bool) Int
- func (p PackedVector2Array) Cap() int
- func (self PackedVector2Array) Clear()
- func (self PackedVector2Array) Count(value Vector2) Int
- func (self PackedVector2Array) Duplicate() PackedVector2Array
- func (self PackedVector2Array) Fill(value Vector2)
- func (self PackedVector2Array) Find(value Vector2, from Int) Int
- func (p PackedVector2Array) Free()
- func (self PackedVector2Array) Has(value Vector2) Bool
- func (p PackedVector2Array) Index(idx Int) Vector2
- func (self PackedVector2Array) Insert(at_index Int, value Vector2) Int
- func (self PackedVector2Array) IsEmpty() Bool
- func (p PackedVector2Array) Len() int
- func (p PackedVector2Array) New() PackedVector2Array
- func (p *PackedVector2Array) Pointer() *PackedVector2Array
- func (self PackedVector2Array) PushBack(value Vector2) Bool
- func (self PackedVector2Array) RemoveAt(index Int)
- func (self PackedVector2Array) Resize(new_size Int) Int
- func (self PackedVector2Array) Reverse()
- func (self PackedVector2Array) Rfind(value Vector2, from Int) Int
- func (self PackedVector2Array) Set(index Int, value Vector2)
- func (p PackedVector2Array) SetIndex(idx Int, value Vector2)
- func (self PackedVector2Array) Size() Int
- func (self PackedVector2Array) Slice(begin Int, end Int) PackedVector2Array
- func (self PackedVector2Array) Sort()
- func (self PackedVector2Array) ToByteArray() PackedByteArray
- type PackedVector3Array
- func (self PackedVector3Array) Append(value Vector3) Bool
- func (self PackedVector3Array) AppendArray(array PackedVector3Array)
- func (p PackedVector3Array) AsSlice() []Vector3
- func (self PackedVector3Array) Bsearch(value Vector3, before Bool) Int
- func (p PackedVector3Array) Cap() int
- func (self PackedVector3Array) Clear()
- func (self PackedVector3Array) Count(value Vector3) Int
- func (self PackedVector3Array) Duplicate() PackedVector3Array
- func (self PackedVector3Array) Fill(value Vector3)
- func (self PackedVector3Array) Find(value Vector3, from Int) Int
- func (p PackedVector3Array) Free()
- func (self PackedVector3Array) Has(value Vector3) Bool
- func (p PackedVector3Array) Index(idx Int) Vector3
- func (self PackedVector3Array) Insert(at_index Int, value Vector3) Int
- func (self PackedVector3Array) IsEmpty() Bool
- func (p PackedVector3Array) Len() int
- func (p PackedVector3Array) New() PackedVector3Array
- func (p *PackedVector3Array) Pointer() *PackedVector3Array
- func (self PackedVector3Array) PushBack(value Vector3) Bool
- func (self PackedVector3Array) RemoveAt(index Int)
- func (self PackedVector3Array) Resize(new_size Int) Int
- func (self PackedVector3Array) Reverse()
- func (self PackedVector3Array) Rfind(value Vector3, from Int) Int
- func (self PackedVector3Array) Set(index Int, value Vector3)
- func (p PackedVector3Array) SetIndex(idx Int, value Vector3)
- func (self PackedVector3Array) Size() Int
- func (self PackedVector3Array) Slice(begin Int, end Int) PackedVector3Array
- func (self PackedVector3Array) Sort()
- func (self PackedVector3Array) ToByteArray() PackedByteArray
- type PackedVector4Array
- func (self PackedVector4Array) Append(value Vector4) Bool
- func (self PackedVector4Array) AppendArray(array PackedVector4Array)
- func (p PackedVector4Array) AsSlice() []Vector4
- func (self PackedVector4Array) Bsearch(value Vector4, before Bool) Int
- func (p PackedVector4Array) Cap() int
- func (self PackedVector4Array) Clear()
- func (self PackedVector4Array) Count(value Vector4) Int
- func (self PackedVector4Array) Duplicate() PackedVector4Array
- func (self PackedVector4Array) Fill(value Vector4)
- func (self PackedVector4Array) Find(value Vector4, from Int) Int
- func (p PackedVector4Array) Free()
- func (self PackedVector4Array) Has(value Vector4) Bool
- func (p PackedVector4Array) Index(idx Int) Vector4
- func (self PackedVector4Array) Insert(at_index Int, value Vector4) Int
- func (self PackedVector4Array) IsEmpty() Bool
- func (p PackedVector4Array) Len() int
- func (p PackedVector4Array) New() PackedVector4Array
- func (p *PackedVector4Array) Pointer() *PackedVector4Array
- func (self PackedVector4Array) PushBack(value Vector4) Bool
- func (self PackedVector4Array) RemoveAt(index Int)
- func (self PackedVector4Array) Resize(new_size Int) Int
- func (self PackedVector4Array) Reverse()
- func (self PackedVector4Array) Rfind(value Vector4, from Int) Int
- func (self PackedVector4Array) Set(index Int, value Vector4)
- func (p PackedVector4Array) SetIndex(idx Int, value Vector4)
- func (self PackedVector4Array) Size() Int
- func (self PackedVector4Array) Slice(begin Int, end Int) PackedVector4Array
- func (self PackedVector4Array) Sort()
- func (self PackedVector4Array) ToByteArray() PackedByteArray
- type PhysicsServer2DExtensionMotionResult
- type PhysicsServer2DExtensionRayResult
- type PhysicsServer2DExtensionShapeRestInfo
- type PhysicsServer2DExtensionShapeResult
- type PhysicsServer3DExtensionMotionCollision
- type PhysicsServer3DExtensionMotionResult
- type PhysicsServer3DExtensionRayResult
- type PhysicsServer3DExtensionShapeRestInfo
- type PhysicsServer3DExtensionShapeResult
- type Plane
- type PointerToClass
- type Projection
- type PropertyInfo
- type Quaternion
- type RID
- type Rect2
- type Rect2i
- type RefCounted
- type ScriptLanguageExtensionProfilingInfo
- type Signal
- func (self Signal) Connect(callable Callable, flags Int) Int
- func (self Signal) Disconnect(callable Callable)
- func (self Signal) Emit(args ...Variant)
- func (s Signal) Free()
- func (self Signal) GetConnections() Array
- func (self Signal) GetName() StringName
- func (self Signal) GetObject() Object
- func (self Signal) GetObjectId() Int
- func (self Signal) IsConnected(callable Callable) Bool
- func (self Signal) IsNull() Bool
- type SignalProxy
- func (SignalProxy) Attach(raw complex128, fn CallableType.Function, flags SignalType.Flags) error
- func (SignalProxy) Consumers(raw complex128) iter.Seq[SignalType.Consumer]
- func (SignalProxy) Emit(raw complex128, values ...VariantPkg.Any)
- func (SignalProxy) Emitter(raw complex128) VariantPkg.Any
- func (SignalProxy) Name(raw complex128) StringType.Readable
- func (SignalProxy) Remove(raw complex128, fn CallableType.Function)
- type Singleton
- type String
- func (s *String) Append(other String)
- func (self String) BeginsWith(text String) Bool
- func (self String) Bigrams() PackedStringArray
- func (self String) BinToInt() Int
- func (self String) CEscape() String
- func (self String) CUnescape() String
- func (s String) Cap() int
- func (self String) Capitalize() String
- func (self String) CasecmpTo(to String) Int
- func (self String) Chr(char Int) String
- func (self String) Contains(what String) Bool
- func (self String) Containsn(what String) Bool
- func (s String) Copy() String
- func (self String) Count(what String, from Int, to Int) Int
- func (self String) Countn(what String, from Int, to Int) Int
- func (self String) Dedent() String
- func (self String) EndsWith(text String) Bool
- func (self String) Erase(position Int, chars Int) String
- func (self String) FilecasecmpTo(to String) Int
- func (self String) FilenocasecmpTo(to String) Int
- func (self String) Find(what String, from Int) Int
- func (self String) Findn(what String, from Int) Int
- func (self String) Format(values Variant, placeholder String) String
- func (s String) Free()
- func (self String) GetBaseDir() String
- func (self String) GetBasename() String
- func (self String) GetExtension() String
- func (self String) GetFile() String
- func (self String) GetSlice(delimiter String, slice Int) String
- func (self String) GetSliceCount(delimiter String) Int
- func (self String) GetSlicec(delimiter Int, slice Int) String
- func (self String) Hash() Int
- func (self String) HexDecode() PackedByteArray
- func (self String) HexToInt() Int
- func (self String) HumanizeSize(size Int) String
- func (self String) Indent(prefix String) String
- func (self String) Insert(position Int, what String) String
- func (self String) IsAbsolutePath() Bool
- func (self String) IsEmpty() Bool
- func (self String) IsRelativePath() Bool
- func (self String) IsSubsequenceOf(text String) Bool
- func (self String) IsSubsequenceOfn(text String) Bool
- func (self String) IsValidFilename() Bool
- func (self String) IsValidFloat() Bool
- func (self String) IsValidHexNumber(with_prefix Bool) Bool
- func (self String) IsValidHtmlColor() Bool
- func (self String) IsValidIdentifier() Bool
- func (self String) IsValidInt() Bool
- func (self String) IsValidIpAddress() Bool
- func (self String) Join(parts PackedStringArray) String
- func (self String) JsonEscape() String
- func (self String) Left(length Int) String
- func (s String) Len() int
- func (self String) Length() Int
- func (self String) Lpad(min_length Int, character String) String
- func (self String) Lstrip(chars String) String
- func (self String) Match(expr String) Bool
- func (self String) Matchn(expr String) Bool
- func (self String) Md5Buffer() PackedByteArray
- func (self String) Md5Text() String
- func (self String) NaturalcasecmpTo(to String) Int
- func (self String) NaturalnocasecmpTo(to String) Int
- func (self String) NocasecmpTo(to String) Int
- func (s String) NodePath() NodePath
- func (self String) Num(number Float, decimals Int) String
- func (self String) NumInt64(number Int, base Int, capitalize_hex Bool) String
- func (self String) NumScientific(number Float) String
- func (self String) NumUint64(number Int, base Int, capitalize_hex Bool) String
- func (self String) PadDecimals(digits Int) String
- func (self String) PadZeros(digits Int) String
- func (self String) PathJoin(file String) String
- func (self String) Repeat(count Int) String
- func (self String) Replace(what String, forwhat String) String
- func (self String) Replacen(what String, forwhat String) String
- func (self String) Reverse() String
- func (self String) Rfind(what String, from Int) Int
- func (self String) Rfindn(what String, from Int) Int
- func (self String) Right(length Int) String
- func (self String) Rpad(min_length Int, character String) String
- func (self String) Rsplit(delimiter String, allow_empty Bool, maxsplit Int) PackedStringArray
- func (self String) Rstrip(chars String) String
- func (self String) Sha1Buffer() PackedByteArray
- func (self String) Sha1Text() String
- func (self String) Sha256Buffer() PackedByteArray
- func (self String) Sha256Text() String
- func (self String) Similarity(text String) Float
- func (self String) SimplifyPath() String
- func (self String) Split(delimiter String, allow_empty Bool, maxsplit Int) PackedStringArray
- func (self String) SplitFloats(delimiter String, allow_empty Bool) PackedFloat64Array
- func (s String) String() string
- func (s String) StringName() StringName
- func (self String) StripEdges(left Bool, right Bool) String
- func (self String) StripEscapes() String
- func (self String) Substr(from Int, len Int) String
- func (self String) ToAsciiBuffer() PackedByteArray
- func (self String) ToCamelCase() String
- func (self String) ToFloat() Float
- func (self String) ToInt() Int
- func (self String) ToLower() String
- func (self String) ToPascalCase() String
- func (self String) ToSnakeCase() String
- func (self String) ToUpper() String
- func (self String) ToUtf16Buffer() PackedByteArray
- func (self String) ToUtf32Buffer() PackedByteArray
- func (self String) ToUtf8Buffer() PackedByteArray
- func (self String) ToWcharBuffer() PackedByteArray
- func (self String) TrimPrefix(prefix String) String
- func (self String) TrimSuffix(suffix String) String
- func (self String) UnicodeAt(at Int) Int
- func (self String) UriDecode() String
- func (self String) UriEncode() String
- func (self String) ValidateFilename() String
- func (self String) ValidateNodeName() String
- func (self String) XmlEscape(escape_quotes Bool) String
- func (self String) XmlUnescape() String
- type StringName
- func (self StringName) BeginsWith(text String) Bool
- func (self StringName) Bigrams() PackedStringArray
- func (self StringName) BinToInt() Int
- func (self StringName) CEscape() String
- func (self StringName) CUnescape() String
- func (self StringName) Capitalize() String
- func (self StringName) CasecmpTo(to String) Int
- func (self StringName) Contains(what String) Bool
- func (self StringName) Containsn(what String) Bool
- func (self StringName) Count(what String, from Int, to Int) Int
- func (self StringName) Countn(what String, from Int, to Int) Int
- func (self StringName) Dedent() String
- func (self StringName) EndsWith(text String) Bool
- func (self StringName) Erase(position Int, chars Int) String
- func (self StringName) FilecasecmpTo(to String) Int
- func (self StringName) FilenocasecmpTo(to String) Int
- func (self StringName) Find(what String, from Int) Int
- func (self StringName) Findn(what String, from Int) Int
- func (self StringName) Format(values Variant, placeholder String) String
- func (s StringName) Free()
- func (self StringName) GetBaseDir() String
- func (self StringName) GetBasename() String
- func (self StringName) GetExtension() String
- func (self StringName) GetFile() String
- func (self StringName) GetSlice(delimiter String, slice Int) String
- func (self StringName) GetSliceCount(delimiter String) Int
- func (self StringName) GetSlicec(delimiter Int, slice Int) String
- func (self StringName) Hash() Int
- func (self StringName) HexDecode() PackedByteArray
- func (self StringName) HexToInt() Int
- func (self StringName) Indent(prefix String) String
- func (self StringName) Insert(position Int, what String) String
- func (self StringName) IsAbsolutePath() Bool
- func (self StringName) IsEmpty() Bool
- func (self StringName) IsRelativePath() Bool
- func (self StringName) IsSubsequenceOf(text String) Bool
- func (self StringName) IsSubsequenceOfn(text String) Bool
- func (self StringName) IsValidFilename() Bool
- func (self StringName) IsValidFloat() Bool
- func (self StringName) IsValidHexNumber(with_prefix Bool) Bool
- func (self StringName) IsValidHtmlColor() Bool
- func (self StringName) IsValidIdentifier() Bool
- func (self StringName) IsValidInt() Bool
- func (self StringName) IsValidIpAddress() Bool
- func (self StringName) Join(parts PackedStringArray) String
- func (self StringName) JsonEscape() String
- func (self StringName) Left(length Int) String
- func (self StringName) Length() Int
- func (self StringName) Lpad(min_length Int, character String) String
- func (self StringName) Lstrip(chars String) String
- func (self StringName) Match(expr String) Bool
- func (self StringName) Matchn(expr String) Bool
- func (self StringName) Md5Buffer() PackedByteArray
- func (self StringName) Md5Text() String
- func (self StringName) NaturalcasecmpTo(to String) Int
- func (self StringName) NaturalnocasecmpTo(to String) Int
- func (self StringName) NocasecmpTo(to String) Int
- func (self StringName) PadDecimals(digits Int) String
- func (self StringName) PadZeros(digits Int) String
- func (self StringName) PathJoin(file String) String
- func (self StringName) Repeat(count Int) String
- func (self StringName) Replace(what String, forwhat String) String
- func (self StringName) Replacen(what String, forwhat String) String
- func (self StringName) Reverse() String
- func (self StringName) Rfind(what String, from Int) Int
- func (self StringName) Rfindn(what String, from Int) Int
- func (self StringName) Right(length Int) String
- func (self StringName) Rpad(min_length Int, character String) String
- func (self StringName) Rsplit(delimiter String, allow_empty Bool, maxsplit Int) PackedStringArray
- func (self StringName) Rstrip(chars String) String
- func (self StringName) Sha1Buffer() PackedByteArray
- func (self StringName) Sha1Text() String
- func (self StringName) Sha256Buffer() PackedByteArray
- func (self StringName) Sha256Text() String
- func (self StringName) Similarity(text String) Float
- func (self StringName) SimplifyPath() String
- func (self StringName) Split(delimiter String, allow_empty Bool, maxsplit Int) PackedStringArray
- func (self StringName) SplitFloats(delimiter String, allow_empty Bool) PackedFloat64Array
- func (s StringName) String() string
- func (self StringName) StripEdges(left Bool, right Bool) String
- func (self StringName) StripEscapes() String
- func (self StringName) Substr(from Int, len Int) String
- func (self StringName) ToAsciiBuffer() PackedByteArray
- func (self StringName) ToCamelCase() String
- func (self StringName) ToFloat() Float
- func (self StringName) ToInt() Int
- func (self StringName) ToLower() String
- func (self StringName) ToPascalCase() String
- func (self StringName) ToSnakeCase() String
- func (self StringName) ToUpper() String
- func (self StringName) ToUtf16Buffer() PackedByteArray
- func (self StringName) ToUtf32Buffer() PackedByteArray
- func (self StringName) ToUtf8Buffer() PackedByteArray
- func (self StringName) ToWcharBuffer() PackedByteArray
- func (self StringName) TrimPrefix(prefix String) String
- func (self StringName) TrimSuffix(suffix String) String
- func (self StringName) UnicodeAt(at Int) Int
- func (self StringName) UriDecode() String
- func (self StringName) UriEncode() String
- func (self StringName) ValidateFilename() String
- func (self StringName) ValidateNodeName() String
- func (self StringName) XmlEscape(escape_quotes Bool) String
- func (self StringName) XmlUnescape() String
- type StringNameProxy
- func (StringNameProxy) AppendOther(raw complex128, api StringType.API, raw2 complex128) StringType.Readable
- func (StringNameProxy) AppendRune(raw complex128, r StringType.Rune) StringType.Readable
- func (StringNameProxy) AppendString(raw complex128, str string) StringType.Readable
- func (StringNameProxy) DecodeRune(raw complex128) (StringType.Rune, int, StringType.Readable)
- func (StringNameProxy) Index(raw complex128, n int) byte
- func (StringNameProxy) Len(raw complex128) int
- func (StringNameProxy) Slice(raw complex128, index int, close int) StringType.Readable
- func (StringNameProxy) String(raw complex128) string
- type StringNamePtr
- type StringProxy
- func (StringProxy) AppendOther(raw complex128, api StringType.API, raw2 complex128) StringType.Readable
- func (StringProxy) AppendRune(raw complex128, r StringType.Rune) StringType.Readable
- func (StringProxy) AppendString(raw complex128, str string) StringType.Readable
- func (StringProxy) DecodeRune(raw complex128) (StringType.Rune, int, StringType.Readable)
- func (StringProxy) Index(raw complex128, n int) byte
- func (StringProxy) Len(raw complex128) int
- func (StringProxy) Slice(raw complex128, index int, close int) StringType.Readable
- func (StringProxy) String(raw complex128) string
- type StringPtr
- type Transform2D
- type Transform3D
- type Variant
- func Abs(x Variant) Variant
- func BytesToVar(bytes PackedByteArray) Variant
- func BytesToVarWithObjects(bytes PackedByteArray) Variant
- func Ceil(x Variant) Variant
- func Clamp(value Variant, min Variant, max Variant) Variant
- func Floor(x Variant) Variant
- func Lerp(from Variant, to Variant, weight Variant) Variant
- func Max(arg1 Variant, arg2 Variant, args ...Variant) Variant
- func Min(arg1 Variant, arg2 Variant, args ...Variant) Variant
- func NewVariant(v any) Variant
- func Round(x Variant) Variant
- func Sign(x Variant) Variant
- func Snapped(x Variant, step Variant) Variant
- func StrToVar(s String) Variant
- func TypeConvert(variant Variant, atype Int) Variant
- func Weakref(obj Variant) Variant
- func Wrap(value Variant, min Variant, max Variant) Variant
- func (variant Variant) AABB() AABB
- func (variant Variant) Add(other Variant) Variant
- func (variant Variant) AtLeast(other Variant) bool
- func (variant Variant) AtMost(other Variant) bool
- func (variant Variant) Basis() Basis
- func (variant Variant) BitAnd(other Variant) Variant
- func (variant Variant) BitNegate() Variant
- func (variant Variant) BitOr(other Variant) Variant
- func (variant Variant) BitXor(other Variant) Variant
- func (variant Variant) Bool() Bool
- func (variant Variant) Call(method StringName, args ...Variant) (Variant, error)
- func (variant Variant) Color() Color
- func (variant Variant) Copy() Variant
- func (variant Variant) Divide(other Variant) Variant
- func (variant Variant) EqualTo(other Variant) bool
- func (variant Variant) Float() Float
- func (s Variant) Free()
- func (variant Variant) Get(key Variant) (val Variant, ok bool)
- func (variant Variant) Hash() Int
- func (variant Variant) In(other Variant) Variant
- func (variant Variant) Int() Int
- func (variant Variant) Interface() any
- func (variant Variant) Iterator() Iterator
- func (variant Variant) LessThan(other Variant) bool
- func (variant Variant) LogicalAnd(other Variant) Variant
- func (variant Variant) LogicalNegate() Variant
- func (variant Variant) LogicalOr(other Variant) Variant
- func (variant Variant) LogicalXor(other Variant) Variant
- func (variant Variant) Modulo(other Variant) Variant
- func (variant Variant) MoreThan(other Variant) bool
- func (variant Variant) Multiply(other Variant) Variant
- func (variant Variant) Negate() Variant
- func (variant Variant) NotEqualTo(other Variant) bool
- func (variant Variant) Plane() Plane
- func (variant Variant) Positive() Variant
- func (variant Variant) Power(other Variant) Variant
- func (variant Variant) Projection() Projection
- func (variant Variant) Quaternion() Quaternion
- func (variant Variant) Rect2() Rect2
- func (variant Variant) Rect2i() Rect2i
- func (variant Variant) RecursiveHash(count Int) Int
- func (variant Variant) Set(key, val Variant) bool
- func (variant Variant) ShiftLeft(other Variant) Variant
- func (variant Variant) ShiftRight(other Variant) Variant
- func (variant Variant) Subtract(other Variant) Variant
- func (variant Variant) Transform2D() Transform2D
- func (variant Variant) Transform3D() Transform3D
- func (variant Variant) Type() VariantType
- func (variant Variant) Vector2() Vector2
- func (variant Variant) Vector2i() Vector2i
- func (variant Variant) Vector3() Vector3
- func (variant Variant) Vector3i() Vector3i
- func (variant Variant) Vector4() Vector4
- func (variant Variant) Vector4i() Vector4i
- type VariantPointers
- type VariantPtr
- type VariantType
- type Vector2
- type Vector2i
- type Vector3
- type Vector3Axis
- type Vector3i
- type Vector4
- type Vector4i
- type Version
Constants ¶
This section is empty.
Variables ¶
var ExtensionInstances sync.Map
var Linked bool = false
var ObjectAs = func(name string, ptr Object) any {
return ptr
}
var PostStartupFunctions []func()
var StartupFunctions []func()
Functions ¶
func ArrayFromSlice ¶
func ArrayFromSlice[T ArrayVariant.Contains[A], A, B any](slice []B) T
func Cleanups ¶
func Cleanups() []func()
Cleanups returns a slice of all registered cleanup functions.
func ConvertToDesiredGoType ¶
func DictionaryAs ¶
func DictionaryAs[T any](dictionary DictionaryType.Any) T
func DictionaryFromMap ¶
func DictionaryFromMap[T any](val T) DictionaryType.Any
func EngineArrayFromSlice ¶
func EngineArrayFromSlice(slice []any) ArrayVariant.Any
func GetLibraryPath ¶
func GetLibraryPath() string
GetLibraryPath returns the path to the library that was loaded.
func InternalPacked ¶
func InternalPacked[P Packed[P, V], V PackedType.Type](array PackedType.Array[V]) P
func LetVariantAsPointerType ¶
func NewSignalCheck ¶
func NewSignalCheck(SignalProxy, complex128) bool
func NodePathCheck ¶
func NodePathCheck(_ NodePathProxy, raw complex128) bool
func PointerBorrowedTemporarily ¶
func PointerBorrowedTemporarily[T pointers.Generic[T, [3]uint64]](ptr EnginePointer) T
func PointerLifetimeBoundTo ¶
func PointerLifetimeBoundTo[T pointers.Generic[T, [3]uint64]](obj [1]Object, ptr EnginePointer) T
func PointerMustAssertInstanceID ¶
func PointerMustAssertInstanceID[T pointers.Generic[T, [3]uint64]](ptr EnginePointer) T
func PointerWithOwnershipTransferredToGo ¶
func PointerWithOwnershipTransferredToGo[T pointers.Generic[T, [3]uint64]](ptr EnginePointer) T
func PrintVerbose ¶
func PushWarning ¶
func RegisterCleanup ¶
func RegisterCleanup(f func())
RegisterCleanup registers a function to be called when the engine shuts down.
func StringCacheCheck ¶
func StringCacheCheck(_ StringProxy, raw complex128) bool
func StringNameCheck ¶
func StringNameCheck(_ StringNameProxy, raw complex128) bool
Types ¶
type API ¶
type API struct { api.Specification GetGodotVersion func() Version GetNativeStructSize func(StringName) uintptr Memory struct { Allocate func(uintptr) Address Reallocate func(Address, uintptr) Address Free func(Address) Index func(addr Address, n int, size uintptr) unsafe.Pointer Write func(dst Address, src unsafe.Pointer, size uintptr) } 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(src Variant) Variant NewNil func() Variant Destroy func(self Variant) Call func(self Variant, method StringName, args ...Variant) (Variant, error) CallStatic func(vtype VariantType, method StringName, args ...Variant) (Variant, error) Evaluate func(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(self, key Variant) (Variant, bool) GetNamed func(self Variant, key StringName) (Variant, bool) GetKeyed func(self, key Variant) (Variant, bool) GetIndexed func(self Variant, index Int) (val Variant, ok, oob bool) IteratorInitialize func(self Variant) (Variant, bool) IteratorNext func(self Variant, iterator Variant) bool IteratorGet func(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(self Variant, deep bool) Variant Stringify func(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(self VariantType) String CanConvert func(self Variant, to VariantType) bool CanConvertStrict func(self Variant, to VariantType) bool FromTypeConstructor func(VariantType) func(ret callframe.Ptr[VariantPointers], arg callframe.Addr) ToTypeConstructor func(VariantType) func(ret callframe.Addr, arg callframe.Ptr[VariantPointers]) PointerOperatorEvaluator func(op Operator, a, b VariantType) func(a, b, ret callframe.Addr) GetPointerBuiltinMethod func(VariantType, StringName, Int) func(base callframe.Addr, args callframe.Args, ret callframe.Addr, c int32) GetPointerConstructor func(vtype VariantType, index int32) func(base callframe.Addr, args callframe.Args) GetPointerDestructor func(VariantType) func(base callframe.Addr) Construct func(t VariantType, args ...Variant) (Variant, error) GetPointerSetter func(VariantType, StringName) func(base, arg callframe.Addr) GetPointerGetter func(VariantType, StringName) func(base, ret callframe.Addr) GetPointerIndexedSetter func(VariantType) func(base callframe.Addr, index Int, arg callframe.Addr) GetPointerIndexedGetter func(VariantType) func(base callframe.Addr, index Int, ret callframe.Addr) GetPointerKeyedSetter func(VariantType) func(base, key, arg callframe.Addr) GetPointerKeyedGetter func(VariantType) func(base, key, ret callframe.Addr) GetPointerKeyedChecker func(VariantType) func(base, key callframe.Addr) uint32 GetConstantValue func(t VariantType, name StringName) Variant GetPointerUtilityFunction func(name StringName, hash Int) func(ret callframe.Addr, args callframe.Args, c int32) } Strings struct { New func(string) String Get func(String) string SetIndex func(String, Int, rune) Index func(String, Int) rune Append func(String, String) String AppendRune func(String, rune) Resize func(String, Int) } StringNames struct { New func(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(PackedStringArray, Int) String SetIndex func(PackedStringArray, Int, String) CopyAsSlice func(PackedStringArray) []String CopyFromSlice func(PackedStringArray, []String) } PackedVector2Array PackedFunctionsFor[PackedVector2Array, Vector2] PackedVector3Array PackedFunctionsFor[PackedVector3Array, Vector3] PackedVector4Array PackedFunctionsFor[PackedVector4Array, Vector4] Array struct { Index func(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(dict Dictionary, key Variant) Variant SetIndex func(dict Dictionary, key, val Variant) } Object struct { MethodBindCall func(method MethodBind, obj [1]Object, arg ...Variant) (Variant, error) MethodBindPointerCall func(method MethodBind, obj [1]Object, arg callframe.Args, ret callframe.Addr) Destroy func([1]Object) GetSingleton func(name StringName) [1]Object GetInstanceBinding func([1]Object, ExtensionToken, InstanceBindingType) any SetInstanceBinding func([1]Object, ExtensionToken, any, InstanceBindingType) FreeInstanceBinding func([1]Object, ExtensionToken) SetInstance func([1]Object, StringName, ObjectInterface) GetClassName func([1]Object, ExtensionToken) String CastTo func([1]Object, ClassTag) [1]Object GetInstanceID func([1]Object) ObjectID GetInstanceFromID func(ObjectID) [1]Object } RefCounted struct { GetObject func([1]Object) [1]Object SetObject func([1]Object, [1]Object) } Callables struct { Create func(fn func(...Variant) (Variant, error)) Callable Get func(Callable) (func(...Variant) (Variant, error), bool) } ClassDB struct { ConstructObject func(StringName) [1]Object GetClassTag func(StringName) ClassTag GetMethodBind func(class, method StringName, hash Int) MethodBind RegisterClass func(library ExtensionToken, name, extends StringName, info ClassInterface) RegisterClassMethod func(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) } EditorHelp struct { Load func([]byte) } GetLibraryPath func(ExtensionToken) String ExtensionToken // extensions instances are mapped here. Singletons singletons // contains filtered or unexported fields }
API specification for Godot's GDExtension.
var Global API
func (*API) Init ¶
func (Godot *API) Init(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) StringFromNodePath ¶
func (*API) StringFromStringName ¶
func (Godot *API) StringFromStringName(s StringName) String
type Array ¶
func InternalArray ¶
func InternalArray[T any](array ArrayVariant.Contains[T]) Array
func (Array) All ¶
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 ¶
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) AppendArray ¶
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 ¶
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 ¶
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 ¶
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 ¶
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) Duplicate ¶
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 ¶
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 ¶
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 ¶
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 ¶
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) Front ¶
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 ¶
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() 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 ¶
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 ¶
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 ¶
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) Insert ¶
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 ¶
Returns [code]true[/code] if the array is empty ([code][][/code]). See also [method size].
func (Array) IsReadOnly ¶
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 ¶
Returns [code]true[/code] if this array is typed the same as the given [param array]. See also [method is_typed].
func (Array) IsTyped ¶
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) 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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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) PushFront ¶
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 ¶
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 ¶
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 ¶
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) Rfind ¶
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) 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 ¶
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 ¶
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 ¶
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 ArrayProxy ¶
type ArrayProxy[T any] struct{}
func NewArrayProxy ¶
func NewArrayProxy[T any]() (ArrayProxy[T], complex128)
func (ArrayProxy[T]) Any ¶
func (ArrayProxy[T]) Any(state complex128) ArrayVariant.Any
func (ArrayProxy[T]) Index ¶
func (ArrayProxy[T]) Index(state complex128, i int) T
func (ArrayProxy[T]) IsReadOnly ¶
func (ArrayProxy[T]) IsReadOnly(state complex128) bool
func (ArrayProxy[T]) Len ¶
func (ArrayProxy[T]) Len(state complex128) int
func (ArrayProxy[T]) MakeReadOnly ¶
func (ArrayProxy[T]) MakeReadOnly(state complex128)
func (ArrayProxy[T]) Resize ¶
func (ArrayProxy[T]) Resize(state complex128, i int)
func (ArrayProxy[T]) SetIndex ¶
func (ArrayProxy[T]) SetIndex(state complex128, i int, val T)
type AudioFrame ¶
type AudioFrame struct {
Left, Right float32
// contains filtered or unexported fields
}
type Bool ¶
type Bool bool
func IsEqualApprox ¶
func IsInstanceIdValid ¶
func IsInstanceValid ¶
func IsZeroApprox ¶
type CallError ¶
type CallError struct { ErrorType CallErrorType Argument int32 Expected int32 }
type CallErrorType ¶
type CallErrorType int32
const ( OK CallErrorType = iota ErrInvalidMethod ErrInvalidArgument ErrTooManyArguments ErrTooFewArguments ErrInstanceIsNil ErrMethodNotConst )
type Callable ¶
func InternalCallable ¶
func InternalCallable(fn CallableType.Function) Callable
func NewCallable ¶
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 (Callable) Bind ¶
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 ¶
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 ¶
Calls the method represented by this Callable. Arguments can be passed and should match the method's signature.
func (Callable) CallDeferred ¶
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 ¶
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(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) GetArgumentCount ¶
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 ¶
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 ¶
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() 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) GetObjectId ¶
Returns the ID of this Callable's object (see [method Object.get_instance_id]).
func (Callable) Hash ¶
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 ¶
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 ¶
Returns [code]true[/code] if this Callable has no target to call the method on.
func (Callable) IsStandard ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 CallableProxy ¶
type CallableProxy struct{}
func (CallableProxy) Args ¶
func (CallableProxy) Args(state complex128) (args int, bind ArrayType.Any)
func (CallableProxy) Bind ¶
func (CallableProxy) Bind(state complex128, args ...VariantPkg.Any) (CallableType.Proxy, complex128)
func (CallableProxy) Call ¶
func (CallableProxy) Call(state complex128, args ...VariantPkg.Any) VariantPkg.Any
func (CallableProxy) Name ¶
func (CallableProxy) Name(state complex128) string
type ClassInterface ¶
type ClassMethodArgumentMetadata ¶
type ClassMethodArgumentMetadata uint32
const ( ArgumentMetadataNone ClassMethodArgumentMetadata = iota ArgumentMetadataIntIsInt8 ArgumentMetadataIntIsInt16 ArgumentMetadataIntIsInt32 ArgumentMetadataIntIsInt64 ArgumentMetadataIntIsUint8 ArgumentMetadataIntIsUint16 ArgumentMetadataIntIsUint32 ArgumentMetadataIntIsUint64 ArgumentMetadataRealIsFloat32 ArgumentMetadataRealIsFloat64 )
type Dictionary ¶
type Dictionary pointers.Solo[Dictionary]
func InternalDictionary ¶
func InternalDictionary[K comparable, V any](dict DictionaryType.Map[K, V]) Dictionary
func NewDictionary ¶
func NewDictionary() Dictionary
func (Dictionary) Clear ¶
func (self Dictionary) Clear()
Clears the dictionary, removing all entries from it.
func (Dictionary) Duplicate ¶
func (self Dictionary) Duplicate(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(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(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(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(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() 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(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() Array
Returns the list of values in this dictionary.
type DictionaryProxy ¶
type DictionaryProxy[K comparable, V any] struct{}
func NewDictionaryProxy ¶
func NewDictionaryProxy[K comparable, V any]() (DictionaryProxy[K, V], complex128)
func (DictionaryProxy[K, V]) Any ¶
func (DictionaryProxy[K, V]) Any(state complex128) DictionaryType.Any
func (DictionaryProxy[K, V]) Clear ¶
func (DictionaryProxy[K, V]) Clear(state complex128)
func (DictionaryProxy[K, V]) Erase ¶
func (DictionaryProxy[K, V]) Erase(state complex128, key K) bool
func (DictionaryProxy[K, V]) Has ¶
func (DictionaryProxy[K, V]) Has(state complex128, key K) bool
func (DictionaryProxy[K, V]) Hash ¶
func (DictionaryProxy[K, V]) Hash(state complex128) uint32
func (DictionaryProxy[K, V]) Index ¶
func (DictionaryProxy[K, V]) Index(state complex128, key K) V
func (DictionaryProxy[K, V]) IsReadOnly ¶
func (DictionaryProxy[K, V]) IsReadOnly(state complex128) bool
func (DictionaryProxy[K, V]) Iter ¶
func (DictionaryProxy[K, V]) Iter(state complex128) iter.Seq2[K, V]
func (DictionaryProxy[K, V]) Len ¶
func (DictionaryProxy[K, V]) Len(state complex128) int
func (DictionaryProxy[K, V]) Lookup ¶
func (DictionaryProxy[K, V]) Lookup(state complex128, key K) (V, bool)
func (DictionaryProxy[K, V]) MakeReadOnly ¶
func (DictionaryProxy[K, V]) MakeReadOnly(state complex128)
func (DictionaryProxy[K, V]) SetIndex ¶
func (DictionaryProxy[K, V]) SetIndex(state complex128, key K, val V)
type EnginePointer ¶
type EnginePointer = uint64
func PointerWithOwnershipTransferredToGodot ¶
func PointerWithOwnershipTransferredToGodot[T pointers.Generic[T, [3]uint64]](ptr T) EnginePointer
type ExtensionToken ¶
type ExtensionToken uintptr
type Float ¶
type Float float64
func AngleDifference ¶
func BezierDerivative ¶
func BezierInterpolate ¶
func CubicInterpolate ¶
func CubicInterpolateAngle ¶
func CubicInterpolateInTime ¶
func DbToLinear ¶
func LinearToDb ¶
func RandfRange ¶
type GDExtensionInitializationLevel ¶
type GDExtensionInitializationLevel int64
const ( GDExtensionInitializationLevelCore GDExtensionInitializationLevel = 0 GDExtensionInitializationLevelServers GDExtensionInitializationLevel = 1 GDExtensionInitializationLevelScene GDExtensionInitializationLevel = 2 GDExtensionInitializationLevelEditor GDExtensionInitializationLevel = 3 )
type InstanceBindingType ¶
type InstanceID ¶
type InstanceID uint64
type Int ¶
type Int int64
func NearestPo2 ¶
func RandiRange ¶
func RidAllocateId ¶
func RidAllocateId() Int
func StepDecimals ¶
type Method ¶
type Method struct { Name StringName Call func(any, ...Variant) (Variant, error) PointerCall func(any, Address, Address) 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 NodePath ¶
func InternalNodePath ¶
func (NodePath) GetAsPropertyPath ¶
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() StringName
Returns all node names concatenated with a slash character ([code]/[/code]) as a single StringName.
func (NodePath) GetConcatenatedSubnames ¶
func (self NodePath) GetConcatenatedSubnames() 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(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 ¶
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(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 ¶
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 ¶
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) InternalString ¶
func (NodePath) IsAbsolute ¶
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 ¶
Returns [code]true[/code] if the node path has been constructed from an empty String ([code]""[/code]).
func (NodePath) Slice ¶
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 NodePathProxy ¶
type NodePathProxy struct{}
func NewNodePathProxy ¶
func NewNodePathProxy() (NodePathProxy, complex128)
func (NodePathProxy) AppendOther ¶
func (NodePathProxy) AppendOther(raw complex128, api StringType.API, raw2 complex128) StringType.Readable
func (NodePathProxy) AppendRune ¶
func (NodePathProxy) AppendRune(raw complex128, r StringType.Rune) StringType.Readable
func (NodePathProxy) AppendString ¶
func (NodePathProxy) AppendString(raw complex128, str string) StringType.Readable
func (NodePathProxy) DecodeRune ¶
func (NodePathProxy) DecodeRune(raw complex128) (StringType.Rune, int, StringType.Readable)
func (NodePathProxy) Index ¶
func (NodePathProxy) Index(raw complex128, n int) byte
func (NodePathProxy) Len ¶
func (NodePathProxy) Len(raw complex128) int
func (NodePathProxy) Slice ¶
func (NodePathProxy) Slice(raw complex128, index int, close int) StringType.Readable
func (NodePathProxy) String ¶
func (NodePathProxy) String(raw complex128) string
type NotificationType ¶
type NotificationType int32
type Object ¶
func InstanceFromId ¶
func (Object) AddUserSignal ¶
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) Callv ¶
func (self Object) Callv(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 ¶
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) Get ¶
func (self Object) Get(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 ¶
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 ¶
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 ¶
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 ¶
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(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 ¶
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 ¶
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 ¶
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 ¶
Returns the object's [Script] instance, or [code]null[/code] if no script is attached.
func (Object) GetSignalConnectionList ¶
func (self Object) GetSignalConnectionList(signal StringName) Array
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 ¶
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 ¶
Returns [code]true[/code] if the object is blocking its signals from being emitted. See [method set_block_signals].
func (Object) IsClass ¶
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 ¶
Returns [code]true[/code] if the [method Node.queue_free] method was called for the object.
func (Object) Notification ¶
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(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 ¶
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 ¶
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 ¶
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) SetScript ¶
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 ¶
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(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(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].
type ObjectConnectFlags ¶
type ObjectConnectFlags int64
type ObjectInterface ¶
type ObjectInterface interface { OnCreate() Set(StringName, Variant) bool Get(StringName) (Variant, bool) GetPropertyList() []PropertyInfo PropertyCanRevert(StringName) bool PropertyGetRevert(StringName) (Variant, bool) ValidateProperty(*PropertyInfo) bool Notification(int32, bool) ToString() (String, bool) Reference() Unreference() CallVirtual(StringName, any, Address, Address) GetRID() RID Free() }
type Packed ¶
type Packed[T any, V PackedType.Type] interface { PackedByteArray | PackedInt32Array | PackedInt64Array | PackedFloat32Array | PackedFloat64Array | PackedStringArray | PackedVector2Array | PackedVector3Array | PackedVector4Array | PackedColorArray pointers.Generic[T, PackedPointers] New() T Len() int Resize(Int) Int Index(Int) V SetIndex(Int, V) }
type PackedByteArray ¶
type PackedByteArray pointers.Pair[PackedByteArray]
func NewPackedByteArray ¶
func NewPackedByteArray() PackedByteArray
func NewPackedByteSlice ¶
func NewPackedByteSlice(data []byte) PackedByteArray
PackedByteSlice returns a PackedByteArray from a byte slice.
func VarToBytes ¶
func VarToBytes(variable Variant) PackedByteArray
func VarToBytesWithObjects ¶
func VarToBytesWithObjects(variable Variant) PackedByteArray
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(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(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(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(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() 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() 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() 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() 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() 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() 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() 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) New ¶
func (p PackedByteArray) New() PackedByteArray
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(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) ToByteArray ¶
func (p PackedByteArray) ToByteArray() PackedByteArray
func (PackedByteArray) ToFloat32Array ¶
func (self PackedByteArray) ToFloat32Array() 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() 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() 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() 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.
type PackedColorArray ¶
type PackedColorArray pointers.Pair[PackedColorArray]
func NewPackedColorArray ¶
func NewPackedColorArray() PackedColorArray
func NewPackedColorSlice ¶
func NewPackedColorSlice(data []Color) PackedColorArray
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) AsSlice ¶
func (p PackedColorArray) AsSlice() []Color
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() 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) New ¶
func (p PackedColorArray) New() PackedColorArray
func (*PackedColorArray) Pointer ¶
func (p *PackedColorArray) Pointer() *PackedColorArray
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(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() PackedByteArray
Returns a PackedByteArray with each color encoded as bytes.
type PackedFloat32Array ¶
type PackedFloat32Array pointers.Pair[PackedFloat32Array]
func NewPackedFloat32Array ¶
func NewPackedFloat32Array() PackedFloat32Array
func NewPackedFloat32Slice ¶
func NewPackedFloat32Slice(data []float32) PackedFloat32Array
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) AsSlice ¶
func (p PackedFloat32Array) AsSlice() []float32
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() 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) New ¶
func (p PackedFloat32Array) New() PackedFloat32Array
func (*PackedFloat32Array) Pointer ¶
func (p *PackedFloat32Array) Pointer() *PackedFloat32Array
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(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() 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].
type PackedFloat64Array ¶
type PackedFloat64Array pointers.Pair[PackedFloat64Array]
func NewPackedFloat64Array ¶
func NewPackedFloat64Array() PackedFloat64Array
func NewPackedFloat64Slice ¶
func NewPackedFloat64Slice(data []float64) PackedFloat64Array
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) AsSlice ¶
func (p PackedFloat64Array) AsSlice() []float64
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() 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) New ¶
func (p PackedFloat64Array) New() PackedFloat64Array
func (*PackedFloat64Array) Pointer ¶
func (p *PackedFloat64Array) Pointer() *PackedFloat64Array
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(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() 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].
type PackedFunctionsFor ¶
type PackedFunctionsFor[T Packed[T, V], V PackedType.Type] struct { Index func(T, Int) V SetIndex func(T, Int, V) CopyAsSlice func(T) []V CopyFromSlice func(T, []V) }
type PackedInt32Array ¶
type PackedInt32Array pointers.Pair[PackedInt32Array]
func NewPackedInt32Array ¶
func NewPackedInt32Array() PackedInt32Array
func NewPackedInt32Slice ¶
func NewPackedInt32Slice(data []int32) PackedInt32Array
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) AsSlice ¶
func (p PackedInt32Array) AsSlice() []int32
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() 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) New ¶
func (p PackedInt32Array) New() PackedInt32Array
func (*PackedInt32Array) Pointer ¶
func (p *PackedInt32Array) Pointer() *PackedInt32Array
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(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() 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].
type PackedInt64Array ¶
type PackedInt64Array pointers.Pair[PackedInt64Array]
func NewPackedInt64Array ¶
func NewPackedInt64Array() PackedInt64Array
func NewPackedInt64Slice ¶
func NewPackedInt64Slice(data []int64) PackedInt64Array
func RandFromSeed ¶
func RandFromSeed(seed Int) PackedInt64Array
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) AsSlice ¶
func (p PackedInt64Array) AsSlice() []int64
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() 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) New ¶
func (p PackedInt64Array) New() PackedInt64Array
func (*PackedInt64Array) Pointer ¶
func (p *PackedInt64Array) Pointer() *PackedInt64Array
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(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() 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].
type PackedPointers ¶
type PackedPointers = [2]uint64
type PackedProxy ¶
type PackedProxy[P Packed[P, V], V PackedType.Type] struct{}
func NewPackedProxy ¶
func NewPackedProxy[P Packed[P, V], V PackedType.Type]() (PackedProxy[P, V], complex128)
func (PackedProxy[P, V]) Any ¶
func (PackedProxy[P, V]) Any(raw complex128) ArrayType.Any
func (PackedProxy[P, V]) Index ¶
func (PackedProxy[P, V]) Index(raw complex128, i int) V
func (PackedProxy[P, V]) IsReadOnly ¶
func (PackedProxy[P, V]) IsReadOnly(complex128) bool
func (PackedProxy[P, V]) Len ¶
func (PackedProxy[P, V]) Len(raw complex128) int
func (PackedProxy[P, V]) MakeReadOnly ¶
func (PackedProxy[P, V]) MakeReadOnly(complex128)
func (PackedProxy[P, V]) Resize ¶
func (PackedProxy[P, V]) Resize(raw complex128, n int)
func (PackedProxy[P, V]) SetIndex ¶
func (PackedProxy[P, V]) SetIndex(raw complex128, i int, v V)
type PackedStringArray ¶
type PackedStringArray pointers.Pair[PackedStringArray]
func InternalPackedStrings ¶
func InternalPackedStrings(array PackedType.Strings) PackedStringArray
func NewPackedStringArray ¶
func NewPackedStringArray() PackedStringArray
func NewPackedStringSlice ¶
func NewPackedStringSlice(data []string) PackedStringArray
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() []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() 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(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) Pointer ¶
func (p *PackedStringArray) Pointer() *PackedStringArray
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(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) Strings ¶
func (p PackedStringArray) Strings() []string
func (PackedStringArray) ToByteArray ¶
func (self PackedStringArray) ToByteArray() PackedByteArray
Returns a PackedByteArray with each string encoded as bytes.
type PackedStringArrayProxy ¶
type PackedStringArrayProxy struct{}
func NewPackedStringProxy ¶
func NewPackedStringProxy() (PackedStringArrayProxy, complex128)
func (PackedStringArrayProxy) Any ¶
func (PackedStringArrayProxy) Any(raw complex128) ArrayType.Any
func (PackedStringArrayProxy) Index ¶
func (PackedStringArrayProxy) Index(raw complex128, i int) StringType.Readable
func (PackedStringArrayProxy) IsReadOnly ¶
func (PackedStringArrayProxy) IsReadOnly(complex128) bool
func (PackedStringArrayProxy) Len ¶
func (PackedStringArrayProxy) Len(raw complex128) int
func (PackedStringArrayProxy) MakeReadOnly ¶
func (PackedStringArrayProxy) MakeReadOnly(complex128)
func (PackedStringArrayProxy) Resize ¶
func (PackedStringArrayProxy) Resize(raw complex128, n int)
func (PackedStringArrayProxy) SetIndex ¶
func (PackedStringArrayProxy) SetIndex(raw complex128, i int, v StringType.Readable)
type PackedVector2Array ¶
type PackedVector2Array pointers.Pair[PackedVector2Array]
func NewPackedVector2Array ¶
func NewPackedVector2Array() PackedVector2Array
func NewPackedVector2Slice ¶
func NewPackedVector2Slice(data []Vector2) PackedVector2Array
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) AsSlice ¶
func (p PackedVector2Array) AsSlice() []Vector2
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() 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) New ¶
func (p PackedVector2Array) New() PackedVector2Array
func (*PackedVector2Array) Pointer ¶
func (p *PackedVector2Array) Pointer() *PackedVector2Array
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(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() PackedByteArray
Returns a PackedByteArray with each vector encoded as bytes.
type PackedVector3Array ¶
type PackedVector3Array pointers.Pair[PackedVector3Array]
func NewPackedVector3Array ¶
func NewPackedVector3Array() PackedVector3Array
func NewPackedVector3Slice ¶
func NewPackedVector3Slice(data []Vector3) PackedVector3Array
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) AsSlice ¶
func (p PackedVector3Array) AsSlice() []Vector3
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() 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) New ¶
func (p PackedVector3Array) New() PackedVector3Array
func (*PackedVector3Array) Pointer ¶
func (p *PackedVector3Array) Pointer() *PackedVector3Array
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(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() PackedByteArray
Returns a PackedByteArray with each vector encoded as bytes.
type PackedVector4Array ¶
type PackedVector4Array pointers.Pair[PackedVector4Array]
func NewPackedVector4Array ¶
func NewPackedVector4Array() PackedVector4Array
func NewPackedVector4Slice ¶
func NewPackedVector4Slice(data []Vector4) PackedVector4Array
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) AsSlice ¶
func (p PackedVector4Array) AsSlice() []Vector4
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() 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) New ¶
func (p PackedVector4Array) New() PackedVector4Array
func (*PackedVector4Array) Pointer ¶
func (p *PackedVector4Array) Pointer() *PackedVector4Array
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(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() PackedByteArray
Returns a PackedByteArray with each vector encoded as bytes.
type PhysicsServer2DExtensionMotionResult ¶
type PhysicsServer2DExtensionMotionResult struct {
Travel, Remainder, CollisionPoint, CollisionNormal, ColliderVelocity Vector2
CollisionDepth, CollisionSafeFraction, CollisionUnsafeFraction float32
CollisionLocalShape int32
ColliderID uint64
ColliderRID RID
ColliderShape int32
// contains filtered or unexported fields
}
type PointerToClass ¶
type Projection ¶
type Projection = struct{ X, Y, Z, W Vector4 }
type PropertyInfo ¶
type PropertyInfo struct { Type VariantType Name StringName ClassName StringName Hint int64 HintString String Usage int64 }
type Quaternion ¶
type RefCounted ¶
func (RefCounted) AsObject ¶
func (self RefCounted) AsObject() [1]Object
func (RefCounted) Free ¶
func (self RefCounted) Free()
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) 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.
type Signal ¶
func InternalSignal ¶
func InternalSignal(signal SignalType.Any) Signal
func NewSignalOf ¶
func NewSignalOf(object [1]Object, signal StringName) Signal
func (Signal) Connect ¶
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 ¶
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 ¶
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) GetConnections ¶
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) GetObjectId ¶
Returns the ID of the object emitting this signal (see [method Object.get_instance_id]).
func (Signal) IsConnected ¶
Returns [code]true[/code] if the specified Callable is connected to this signal.
type SignalProxy ¶
type SignalProxy struct{}
func NewSignalProxy ¶
func NewSignalProxy() (SignalProxy, complex128)
func (SignalProxy) Attach ¶
func (SignalProxy) Attach(raw complex128, fn CallableType.Function, flags SignalType.Flags) error
func (SignalProxy) Consumers ¶
func (SignalProxy) Consumers(raw complex128) iter.Seq[SignalType.Consumer]
func (SignalProxy) Emit ¶
func (SignalProxy) Emit(raw complex128, values ...VariantPkg.Any)
func (SignalProxy) Emitter ¶
func (SignalProxy) Emitter(raw complex128) VariantPkg.Any
func (SignalProxy) Name ¶
func (SignalProxy) Name(raw complex128) StringType.Readable
func (SignalProxy) Remove ¶
func (SignalProxy) Remove(raw complex128, fn CallableType.Function)
type String ¶
func ErrorString ¶
func InternalString ¶
func InternalString(s StringType.Readable) String
func TypeToString ¶
func (String) BeginsWith ¶
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() 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 ¶
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 ¶
Returns a copy of the string with special characters escaped using the C language standard.
func (String) CUnescape ¶
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) Capitalize ¶
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 ¶
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 ¶
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 ¶
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 ¶
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) Count ¶
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 ¶
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 ¶
Returns a copy of the string with indentation (leading tabs and spaces) removed. See also [method indent] to add indentation.
func (String) EndsWith ¶
Returns [code]true[/code] if the string ends with the given [param text]. See also [method begins_with].
func (String) Erase ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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) GetBaseDir ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
Returns the total number of slices when the string is split with the given [param delimiter] (see [method split]).
func (String) GetSlicec ¶
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 ¶
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() 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 ¶
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 ¶
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 ¶
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) IsAbsolutePath ¶
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 ¶
Returns [code]true[/code] if the string's length is [code]0[/code] ([code]""[/code]). See also [method length].
func (String) IsRelativePath ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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(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 ¶
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 ¶
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) Length ¶
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 ¶
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 ¶
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 ¶
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 ¶
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() PackedByteArray
Returns the [url=https://en.wikipedia.org/wiki/MD5]MD5 hash[/url] of the string as a PackedByteArray.
func (String) Md5Text ¶
Returns the [url=https://en.wikipedia.org/wiki/MD5]MD5 hash[/url] of the string as another String.
func (String) NaturalcasecmpTo ¶
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 ¶
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 ¶
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) Num ¶
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 ¶
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 ¶
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 ¶
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 ¶
Formats the string representing a number to have an exact number of [param digits] [i]after[/i] the decimal point.
func (String) PadZeros ¶
Formats the string representing a number to have an exact number of [param digits] [i]before[/i] the decimal point.
func (String) PathJoin ¶
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 ¶
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 ¶
Replaces all occurrences of [param what] inside the string with the given [param forwhat].
func (String) Replacen ¶
Replaces all [b]case-insensitive[/b] occurrences of [param what] inside the string with the given [param forwhat].
func (String) Reverse ¶
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 ¶
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 ¶
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 ¶
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 ¶
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(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 ¶
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() PackedByteArray
Returns the [url=https://en.wikipedia.org/wiki/SHA-1]SHA-1[/url] hash of the string as a PackedByteArray.
func (String) Sha1Text ¶
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() PackedByteArray
Returns the [url=https://en.wikipedia.org/wiki/SHA-2]SHA-256[/url] hash of the string as a PackedByteArray.
func (String) Sha256Text ¶
Returns the [url=https://en.wikipedia.org/wiki/SHA-2]SHA-256[/url] hash of the string as another String.
func (String) Similarity ¶
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 ¶
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(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(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) StringName ¶
func (s String) StringName() StringName
func (String) StripEdges ¶
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 ¶
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 ¶
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() 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 ¶
Returns the string converted to [code]camelCase[/code].
func (String) ToFloat ¶
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 ¶
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) ToPascalCase ¶
Returns the string converted to [code]PascalCase[/code].
func (String) ToSnakeCase ¶
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) ToUtf16Buffer ¶
func (self String) ToUtf16Buffer() 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() 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() 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() 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 ¶
Removes the given [param prefix] from the start of the string, or returns the string unchanged.
func (String) TrimSuffix ¶
Removes the given [param suffix] from the end of the string, or returns the string unchanged.
func (String) UriDecode ¶
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 ¶
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 ¶
Returns a copy of the string with all characters that are not allowed in [method is_valid_filename] replaced with underscores.
func (String) ValidateNodeName ¶
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 ¶
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 ¶
Returns a copy of the string with escaped characters replaced by their meanings according to the XML standard.
type StringName ¶
type StringName pointers.Solo[StringName]
func InternalStringName ¶
func InternalStringName(s StringType.Name) StringName
func NewStringName ¶
func NewStringName(s string) StringName
StringName returns a StringName from a standard UTF8 Go string.
func NewStringNameFromString ¶
func NewStringNameFromString(s String) StringName
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() 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() String
Returns a copy of the string with special characters escaped using the C language standard.
func (StringName) CUnescape ¶
func (self StringName) CUnescape() 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() 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() 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(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(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() 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() 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() 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() 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(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(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() 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(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(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(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() 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(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(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(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() 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() 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(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(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(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(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(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(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() 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(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(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(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(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() 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() 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() 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() 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() 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(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(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(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() 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(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() 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() 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() String
Returns the string converted to [code]lowercase[/code].
func (StringName) ToPascalCase ¶
func (self StringName) ToPascalCase() String
Returns the string converted to [code]PascalCase[/code].
func (StringName) ToSnakeCase ¶
func (self StringName) ToSnakeCase() 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() String
Returns the string converted to [code]UPPERCASE[/code].
func (StringName) ToUtf16Buffer ¶
func (self StringName) ToUtf16Buffer() 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() 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() 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() 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(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(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() 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() 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() 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() 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(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() String
Returns a copy of the string with escaped characters replaced by their meanings according to the XML standard.
type StringNameProxy ¶
type StringNameProxy struct{}
func NewStringNameProxy ¶
func NewStringNameProxy() (StringNameProxy, complex128)
func (StringNameProxy) AppendOther ¶
func (StringNameProxy) AppendOther(raw complex128, api StringType.API, raw2 complex128) StringType.Readable
func (StringNameProxy) AppendRune ¶
func (StringNameProxy) AppendRune(raw complex128, r StringType.Rune) StringType.Readable
func (StringNameProxy) AppendString ¶
func (StringNameProxy) AppendString(raw complex128, str string) StringType.Readable
func (StringNameProxy) DecodeRune ¶
func (StringNameProxy) DecodeRune(raw complex128) (StringType.Rune, int, StringType.Readable)
func (StringNameProxy) Index ¶
func (StringNameProxy) Index(raw complex128, n int) byte
func (StringNameProxy) Len ¶
func (StringNameProxy) Len(raw complex128) int
func (StringNameProxy) Slice ¶
func (StringNameProxy) Slice(raw complex128, index int, close int) StringType.Readable
func (StringNameProxy) String ¶
func (StringNameProxy) String(raw complex128) string
type StringNamePtr ¶
type StringNamePtr *uintptr
type StringProxy ¶
type StringProxy struct{}
func NewStringProxy ¶
func NewStringProxy() (StringProxy, complex128)
func (StringProxy) AppendOther ¶
func (StringProxy) AppendOther(raw complex128, api StringType.API, raw2 complex128) StringType.Readable
func (StringProxy) AppendRune ¶
func (StringProxy) AppendRune(raw complex128, r StringType.Rune) StringType.Readable
func (StringProxy) AppendString ¶
func (StringProxy) AppendString(raw complex128, str string) StringType.Readable
func (StringProxy) DecodeRune ¶
func (StringProxy) DecodeRune(raw complex128) (StringType.Rune, int, StringType.Readable)
func (StringProxy) Index ¶
func (StringProxy) Index(raw complex128, n int) byte
func (StringProxy) Len ¶
func (StringProxy) Len(raw complex128) int
func (StringProxy) Slice ¶
func (StringProxy) Slice(raw complex128, index int, close int) StringType.Readable
func (StringProxy) String ¶
func (StringProxy) String(raw complex128) string
type Transform2D ¶
func NewTransform2D ¶
func NewTransform2D(a, b, c, d, e, f Float) Transform2D
type Transform3D ¶
func NewTransform3D ¶
func NewTransform3D(a, b, c, d, e, f, g, h, i, j, k, l Float) Transform3D
type Variant ¶
func BytesToVar ¶
func BytesToVar(bytes PackedByteArray) Variant
func BytesToVarWithObjects ¶
func BytesToVarWithObjects(bytes PackedByteArray) Variant
func NewVariant ¶
Variant returns a variant from the given value, which must be one of the basic godot types defined in the gd package.
func TypeConvert ¶
func (Variant) Call ¶
func (variant Variant) Call(method StringName, args ...Variant) (Variant, error)
Call calls a method on the variant dynamically.
func (Variant) Get ¶
Get returns the value specified by the given key variant and a boolean indiciating whether the get operation was valid.
func (Variant) Interface ¶
Interface returns the variant's value as one of the the native Godot values (as defined) in the gd package.
func (Variant) LogicalAnd ¶
func (Variant) LogicalNegate ¶
func (Variant) LogicalXor ¶
func (Variant) NotEqualTo ¶
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) Rect2i ¶
Rect2i returns the variant as a Rect2i. Panics if the variant is not a Rect2i.
func (Variant) RecursiveHash ¶
RecursiveHash returns the hash value of the variant recursively.
func (Variant) Set ¶
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) ShiftRight ¶
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 ¶
Vector2 returns the variant as a Vector2. Panics if the variant is not a Vector2.
func (Variant) Vector2i ¶
Vector2i returns the variant as a Vector2i. Panics if the variant is not a Vector2i.
func (Variant) Vector3 ¶
Vector3 returns the variant as a Vector3. Panics if the variant is not a Vector3.
func (Variant) Vector3i ¶
Vector3i returns the variant as a Vector3i. Panics if the variant is not a Vector3i.
type VariantPointers ¶
type VariantPointers = [3]uint64
type VariantPtr ¶
type VariantPtr *[3]uintptr
type VariantType ¶
type VariantType int
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 VariantTypeOf ¶
func VariantTypeOf(rtype reflect.Type) (vtype VariantType, ok bool)
func (VariantType) Call ¶
func (variant VariantType) Call(method StringName, args ...Variant) (Variant, error)
Call a static method on a variant type.
func (VariantType) New ¶
func (variant VariantType) New(args ...Variant) (Variant, error)
New calls the variant constructor with the given arguments and returns the result as a variant.
func (VariantType) String ¶
func (t VariantType) String() string
type Vector3Axis ¶
Source Files ¶
- all.go
- api.go
- arrays.go
- callables.go
- cgo.go
- cleanups.go
- convert_types.go
- ctx.go
- dictionary.go
- errors.go
- garbage.go
- lnk.go
- math.go
- oop.go
- out.go
- packed.go
- packed_v2.go
- pointer_types.go
- pointer_types_64.go
- signals.go
- strings.go
- var.go
- variant_api.go
- variant_conversions.go
- variant_operators.go
- variant_reflect.go
- variant_typeof.go
Directories ¶
Path | Synopsis |
---|---|
Code generated by the generate package DO NOT EDIT
|
Code generated by the generate package DO NOT EDIT |
Package gdextension is the graphics.gd authorative Go representation of the Godot C GDExtension API.
|
Package gdextension is the graphics.gd authorative Go representation of the Godot C GDExtension API. |
Package pointers provides managed pointers that are invisible to the Go runtime.
|
Package pointers provides managed pointers that are invisible to the Go runtime. |
tool
|
|
builtins
builtins checks gdmaths and gdvalue packages for builtin class methods and reports any builtin methods that are missing from gd or any duplicates.
|
builtins checks gdmaths and gdvalue packages for builtin class methods and reports any builtin methods that are missing from gd or any duplicates. |