Godot::GodotArray(T)
Inherits Enumerable < Reference < Object
A high-level Crystal wrapper around Godot's native Array type.
Named GodotArray to avoid shadowing Crystal's top-level ::Array.
Implements Enumerable and provides seamless conversion to/from Crystal Array.
Constructors
new(ptr : Pointer(Void) = Pointer(Void).null)
SourceClass methods
Instance methods
<<(value : T) : self
Source[](index : Int32) : T
Source[]=(index : Int32, value : T) : T
Source[]?(index : Int32) : T | Nil
Sourceclear
Sourceempty?
Returns true if self does not contain any element.
([] of Int32).empty? # => true
([1]).empty? # => false
[nil, false].empty? # => false
#present?returns the inverse.
pop
Sourcepush(value : T) : self
Sourceshift
Sourceto_a
Returns an Array with all the elements in the collection.
(1..5).to_a # => [1, 2, 3, 4, 5]
to_s(io : IO) : Void
Appends a short String representation of this object which includes its class name and its object address.
class Person
def initialize(@name : String, @age : Int32)
end
end
Person.new("John", 32).to_s # => #<Person:0x10a199f20>