Variant class

    A Variant can:

    • Store almost any datatype
    • Be hashed, so it can be compared quickly to other variants
    • Be used to convert safely between datatypes
    • Be used to abstract calling methods and their arguments (Godot exports all its functions through variants)
    • Be used to defer calls or move data between threads.
    • Be serialized as binary and stored to disk, or transferred via network.
    • Work as an exported property, so the editor can edit it universally.
    • Be used for dictionaries, arrays, parsers, etc.

    Containers: Dictionary and Array

    Both are implemented using variants. A Dictionary can match any datatype used as key to any other datatype. An Array just holds an array of Variants. Of course, a Variant can also hold a Dictionary and an Array inside, making it even more flexible.

    Copy-on-write (COW) mode support for containers was dropped with Godot 3.0.

    References: