Skip to reading
GDScript Programming & Godot

type_convert()

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView PDF page
On this page

Earlier edition reference / Current 0.86.4.0 property paths > p. 350

Code example
type_convert(variant: Variant, type: int) -> Variant

Query a Variant type ID, name a type ID, or convert to a requested type.

type_string()#

Code example
type_string(type: int) -> String

Query a Variant type ID, name a type ID, or convert to a requested type.

typeof()#

Code example
typeof(variable: Variant) -> int

Query a Variant type ID, name a type ID, or convert to a requested type.

var_to_bytes()#

Code example
var_to_bytes(variable: Variant) -> PackedByteArray

Convert supported Variant data to/from binary data without object encoding.

var_to_bytes_with_objects()#

Code example
var_to_bytes_with_objects(variable: Variant) -> PackedByteArray

Binary Variant conversion that can include objects; use only with an intentional trusted-data format.

var_to_str()#

Code example
var_to_str(variable: Variant) -> String

Convert supported Variant data to/from Godot’s text representation.

Page 318 of 378Permalink
Go to page