struct

Godot::Variant

Inherits Struct < Value < Object

Represents a dynamically typed Godot Variant value in Crystal with zero-allocation unboxing for primitive and engine math types.

Constructors

from_arg(arg : LibBridge::VariantArg) : Variant

Constructs a Variant directly from a native C-bridge VariantArg.

Source
new(raw : VariantValue = nil)
Source
new(val : Int32)
Source
new(val : UInt32)
Source
new(val : UInt64)
Source
new(val : Float32)
Source
new(val : Symbol)
Source

Class methods

default_for(type : T.class) : T forall T

Returns safe default value for target type T

Source

Instance methods

==(other : Variant) : Bool
Source
==(other : String) : Bool
Source
==(other : Number) : Bool
Source
==(other : Bool) : Bool
Source
==(other : Godot::Object) : Bool
Source
as_aabb
Source
as_basis
Source
as_bool
Source
as_color
Source
as_f
Source
as_f32
Source
as_f64
Source
as_i
Source
as_i32
Source
as_i64
Source
as_node
Source
as_obj
Source
as_plane
Source
as_quat
Source
as_rect2
Source
as_rect2i
Source
as_s
Source
as_str
Source
as_t(type : T.class) : T forall T

Unboxes the Variant to target type T at compile time.

Source
as_transform2d
Source
as_transform3d
Source
as_u32
Source
as_u64
Source
as_v2
Source
as_v2i
Source
as_v3
Source
as_v3i
Source
as_v4
Source
as_v4i
Source
bool?
Source
empty?
Source
float?
Source
int?
Source
is_nil?
Source
object?
Source
string?
Source
to_s(io : IO) : Void

Same as #inspect(io).

Source