.. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead. .. _class_@GDScript: @GDScript ========= **Category:** Core Brief Description ----------------- Built-in GDScript functions. Member Functions ---------------- +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Color` | :ref:`Color8` **(** :ref:`int` r8, :ref:`int` g8, :ref:`int` b8, :ref:`int` a8 **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Color` | :ref:`ColorN` **(** :ref:`String` name, :ref:`float` alpha **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`abs` **(** :ref:`float` s **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`acos` **(** :ref:`float` s **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`asin` **(** :ref:`float` s **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Nil` | :ref:`assert` **(** :ref:`bool` condition **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`atan` **(** :ref:`float` s **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`atan2` **(** :ref:`float` x, :ref:`float` y **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Variant` | :ref:`bytes2var` **(** :ref:`PoolByteArray` bytes **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`ceil` **(** :ref:`float` s **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`char` **(** :ref:`int` ascii **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`clamp` **(** :ref:`float` val, :ref:`float` min, :ref:`float` max **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Object` | :ref:`convert` **(** :ref:`Variant` what, :ref:`int` type **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`cos` **(** :ref:`float` s **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`cosh` **(** :ref:`float` s **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`db2linear` **(** :ref:`float` db **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`decimals` **(** :ref:`float` step **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`dectime` **(** :ref:`float` value, :ref:`float` amount, :ref:`float` step **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`deg2rad` **(** :ref:`float` deg **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Object` | :ref:`dict2inst` **(** :ref:`Dictionary` dict **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`ease` **(** :ref:`float` s, :ref:`float` curve **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`exp` **(** :ref:`float` s **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`floor` **(** :ref:`float` s **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`fmod` **(** :ref:`float` x, :ref:`float` y **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`fposmod` **(** :ref:`float` x, :ref:`float` y **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`FuncRef` | :ref:`funcref` **(** :ref:`Object` instance, :ref:`String` funcname **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`hash` **(** :ref:`Variant` var:Variant **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Dictionary` | :ref:`inst2dict` **(** :ref:`Object` inst **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Object` | :ref:`instance_from_id` **(** :ref:`int` instance_id **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`is_inf` **(** :ref:`float` s **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`is_nan` **(** :ref:`float` s **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`lerp` **(** :ref:`float` from, :ref:`float` to, :ref:`float` weight **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`linear2db` **(** :ref:`float` nrg **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Resource` | :ref:`load` **(** :ref:`String` path **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`log` **(** :ref:`float` s **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`max` **(** :ref:`float` a, :ref:`float` b **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`min` **(** :ref:`float` a, :ref:`float` b **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`nearest_po2` **(** :ref:`int` val **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Variant` | :ref:`parse_json` **(** :ref:`String` json **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`pow` **(** :ref:`float` x, :ref:`float` y **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Resource` | :ref:`preload` **(** :ref:`String` path **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Nil` | :ref:`print` **(** :ref:`Variant` what, :ref:`Variant` ... **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Nil` | :ref:`print_stack` **(** **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Nil` | :ref:`printerr` **(** :ref:`Variant` what, :ref:`Variant` ... **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Nil` | :ref:`printraw` **(** :ref:`Variant` what, :ref:`Variant` ... **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Nil` | :ref:`prints` **(** :ref:`Variant` what, :ref:`Variant` ... **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Nil` | :ref:`printt` **(** :ref:`Variant` what, :ref:`Variant` ... **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`rad2deg` **(** :ref:`float` rad **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`rand_range` **(** :ref:`float` from, :ref:`float` to **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array` | :ref:`rand_seed` **(** :ref:`int` seed **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`randf` **(** **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`randi` **(** **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Nil` | :ref:`randomize` **(** **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array` | :ref:`range` **(** :ref:`Variant` ... **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`round` **(** :ref:`float` s **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Nil` | :ref:`seed` **(** :ref:`int` seed **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`sign` **(** :ref:`float` s **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`sin` **(** :ref:`float` s **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`sinh` **(** :ref:`float` s **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`sqrt` **(** :ref:`float` s **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`stepify` **(** :ref:`float` s, :ref:`float` step **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`str` **(** :ref:`Variant` what, :ref:`Variant` ... **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Variant` | :ref:`str2var` **(** :ref:`String` string **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`tan` **(** :ref:`float` s **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`tanh` **(** :ref:`float` s **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`to_json` **(** :ref:`Variant` var:Variant **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`type_exists` **(** :ref:`String` type **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`typeof` **(** :ref:`Variant` what **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Variant` | :ref:`validate_json` **(** :ref:`String` json **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PoolByteArray` | :ref:`var2bytes` **(** :ref:`Variant` var **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`var2str` **(** :ref:`Variant` var **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`WeakRef` | :ref:`weakref` **(** :ref:`Object` obj **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`GDFunctionState` | :ref:`yield` **(** :ref:`Object` object, :ref:`String` signal **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ Numeric Constants ----------------- - **PI** = **3.141593** --- Constant that represents how many times the diameter of a circumference fits around its perimeter. - **INF** = **inf** - **NAN** = **nan** Description ----------- This contains the list of built-in gdscript functions. Mostly math functions and other utilities. Everything else is expanded by objects. Member Function Description --------------------------- .. _class_@GDScript_Color8: - :ref:`Color` **Color8** **(** :ref:`int` r8, :ref:`int` g8, :ref:`int` b8, :ref:`int` a8 **)** Make a color from red, green, blue and alpha. Arguments can range from 0 to 255. .. _class_@GDScript_ColorN: - :ref:`Color` **ColorN** **(** :ref:`String` name, :ref:`float` alpha **)** .. _class_@GDScript_abs: - :ref:`float` **abs** **(** :ref:`float` s **)** Remove sign (works for integer and float). .. _class_@GDScript_acos: - :ref:`float` **acos** **(** :ref:`float` s **)** Arc-cosine. .. _class_@GDScript_asin: - :ref:`float` **asin** **(** :ref:`float` s **)** Arc-sine. .. _class_@GDScript_assert: - :ref:`Nil` **assert** **(** :ref:`bool` condition **)** Assert that the condition is true. If the condition is false, generates an error. .. _class_@GDScript_atan: - :ref:`float` **atan** **(** :ref:`float` s **)** Arc-tangent. .. _class_@GDScript_atan2: - :ref:`float` **atan2** **(** :ref:`float` x, :ref:`float` y **)** Arc-tangent that takes a 2D vector as argument, returns the full -pi to +pi range. .. _class_@GDScript_bytes2var: - :ref:`Variant` **bytes2var** **(** :ref:`PoolByteArray` bytes **)** Decode a byte array back to a value. .. _class_@GDScript_ceil: - :ref:`float` **ceil** **(** :ref:`float` s **)** Ceiling (rounds up to nearest integer). .. _class_@GDScript_char: - :ref:`String` **char** **(** :ref:`int` ascii **)** .. _class_@GDScript_clamp: - :ref:`float` **clamp** **(** :ref:`float` val, :ref:`float` min, :ref:`float` max **)** Clamp both values to a range. .. _class_@GDScript_convert: - :ref:`Object` **convert** **(** :ref:`Variant` what, :ref:`int` type **)** Convert from a type to another in the best way possible. The "type" parameter uses the enum TYPE\_\* in :ref:`@Global Scope`. .. _class_@GDScript_cos: - :ref:`float` **cos** **(** :ref:`float` s **)** Standard cosine function. .. _class_@GDScript_cosh: - :ref:`float` **cosh** **(** :ref:`float` s **)** Hyperbolic cosine. .. _class_@GDScript_db2linear: - :ref:`float` **db2linear** **(** :ref:`float` db **)** Convert from decibels to linear energy (audio). .. _class_@GDScript_decimals: - :ref:`float` **decimals** **(** :ref:`float` step **)** Return the amount of decimals in the floating point value. .. _class_@GDScript_dectime: - :ref:`float` **dectime** **(** :ref:`float` value, :ref:`float` amount, :ref:`float` step **)** Decreases time by a specified amount. .. _class_@GDScript_deg2rad: - :ref:`float` **deg2rad** **(** :ref:`float` deg **)** Convert from degrees to radians. .. _class_@GDScript_dict2inst: - :ref:`Object` **dict2inst** **(** :ref:`Dictionary` dict **)** Convert a previously converted instances to dictionary back into an instance. Useful for deserializing. .. _class_@GDScript_ease: - :ref:`float` **ease** **(** :ref:`float` s, :ref:`float` curve **)** Easing function, based on exponent. 0 is constant, 1 is linear, 0 to 1 is ease-in, 1+ is ease out. Negative values are in-out/out in. .. _class_@GDScript_exp: - :ref:`float` **exp** **(** :ref:`float` s **)** Exponential logarithm. .. _class_@GDScript_floor: - :ref:`float` **floor** **(** :ref:`float` s **)** Floor (rounds down to nearest integer). .. _class_@GDScript_fmod: - :ref:`float` **fmod** **(** :ref:`float` x, :ref:`float` y **)** Module (remainder of x/y). .. _class_@GDScript_fposmod: - :ref:`float` **fposmod** **(** :ref:`float` x, :ref:`float` y **)** Module (remainder of x/y) that wraps equally in positive and negative. .. _class_@GDScript_funcref: - :ref:`FuncRef` **funcref** **(** :ref:`Object` instance, :ref:`String` funcname **)** Return a reference to the specified function. .. _class_@GDScript_hash: - :ref:`int` **hash** **(** :ref:`Variant` var:Variant **)** Hash the variable passed and return an integer. .. _class_@GDScript_inst2dict: - :ref:`Dictionary` **inst2dict** **(** :ref:`Object` inst **)** Convert a script class instance to a dictionary (useful for serializing). .. _class_@GDScript_instance_from_id: - :ref:`Object` **instance_from_id** **(** :ref:`int` instance_id **)** Get an object by its ID. .. _class_@GDScript_is_inf: - :ref:`float` **is_inf** **(** :ref:`float` s **)** .. _class_@GDScript_is_nan: - :ref:`float` **is_nan** **(** :ref:`float` s **)** .. _class_@GDScript_lerp: - :ref:`float` **lerp** **(** :ref:`float` from, :ref:`float` to, :ref:`float` weight **)** Linear interpolates between two values by a normalized value. .. _class_@GDScript_linear2db: - :ref:`float` **linear2db** **(** :ref:`float` nrg **)** Convert from linear energy to decibels (audio). .. _class_@GDScript_load: - :ref:`Resource` **load** **(** :ref:`String` path **)** Load a resource from the filesystem, pass a valid path as argument. .. _class_@GDScript_log: - :ref:`float` **log** **(** :ref:`float` s **)** Natural logarithm. .. _class_@GDScript_max: - :ref:`float` **max** **(** :ref:`float` a, :ref:`float` b **)** Return the maximum of two values. .. _class_@GDScript_min: - :ref:`float` **min** **(** :ref:`float` a, :ref:`float` b **)** Return the minimum of two values. .. _class_@GDScript_nearest_po2: - :ref:`int` **nearest_po2** **(** :ref:`int` val **)** Return the nearest larger power of 2 for an integer. .. _class_@GDScript_parse_json: - :ref:`Variant` **parse_json** **(** :ref:`String` json **)** Parse json text to a Variant (use :ref:`typeof` to check if it is what you expect). .. _class_@GDScript_pow: - :ref:`float` **pow** **(** :ref:`float` x, :ref:`float` y **)** Power function, x elevate to y. .. _class_@GDScript_preload: - :ref:`Resource` **preload** **(** :ref:`String` path **)** Preload a resource from the filesystem. The resource is loaded during script parsing. .. _class_@GDScript_print: - :ref:`Nil` **print** **(** :ref:`Variant` what, :ref:`Variant` ... **)** Print one or more arguments to strings in the best way possible to a console line. .. _class_@GDScript_print_stack: - :ref:`Nil` **print_stack** **(** **)** Print a stack track at code location, only works when running with debugger turned on. .. _class_@GDScript_printerr: - :ref:`Nil` **printerr** **(** :ref:`Variant` what, :ref:`Variant` ... **)** Print one or more arguments to strings in the best way possible to standard error line. .. _class_@GDScript_printraw: - :ref:`Nil` **printraw** **(** :ref:`Variant` what, :ref:`Variant` ... **)** Print one or more arguments to strings in the best way possible to console. No newline is added at the end. .. _class_@GDScript_prints: - :ref:`Nil` **prints** **(** :ref:`Variant` what, :ref:`Variant` ... **)** Print one or more arguments to the console with a space between each argument. .. _class_@GDScript_printt: - :ref:`Nil` **printt** **(** :ref:`Variant` what, :ref:`Variant` ... **)** Print one or more arguments to the console with a tab between each argument. .. _class_@GDScript_rad2deg: - :ref:`float` **rad2deg** **(** :ref:`float` rad **)** Convert from radians to degrees. .. _class_@GDScript_rand_range: - :ref:`float` **rand_range** **(** :ref:`float` from, :ref:`float` to **)** Random range, any floating point value between 'from' and 'to'. .. _class_@GDScript_rand_seed: - :ref:`Array` **rand_seed** **(** :ref:`int` seed **)** Random from seed: pass a seed, and an array with both number and new seed is returned. "Seed" here refers to the internal state of the pseudo random number generator. The internal state of the current implementation is 64 bits. .. _class_@GDScript_randf: - :ref:`float` **randf** **(** **)** Return a random floating point value between 0 and 1. .. _class_@GDScript_randi: - :ref:`int` **randi** **(** **)** Return a random 32 bits integer value. To obtain a random value between 0 to N (where N is smaller than 2^32 - 1), you can use remainder. For example, to get a random integer between 0 and 19 inclusive, you can use randi() % 20. .. _class_@GDScript_randomize: - :ref:`Nil` **randomize** **(** **)** Randomize the seed (or the internal state) of the random number generator. Current implementation reseeds using a number based on time. .. _class_@GDScript_range: - :ref:`Array` **range** **(** :ref:`Variant` ... **)** Return an array with the given range. Range can be 1 argument N (0 to N-1), two arguments (initial, final-1) or three arguments (initial, final-1, increment). .. _class_@GDScript_round: - :ref:`float` **round** **(** :ref:`float` s **)** Round to nearest integer. .. _class_@GDScript_seed: - :ref:`Nil` **seed** **(** :ref:`int` seed **)** Set seed for the random number generator. .. _class_@GDScript_sign: - :ref:`float` **sign** **(** :ref:`float` s **)** Return sign (-1 or +1). .. _class_@GDScript_sin: - :ref:`float` **sin** **(** :ref:`float` s **)** Standard sine function. .. _class_@GDScript_sinh: - :ref:`float` **sinh** **(** :ref:`float` s **)** Hyperbolic sine. .. _class_@GDScript_sqrt: - :ref:`float` **sqrt** **(** :ref:`float` s **)** Square root. .. _class_@GDScript_stepify: - :ref:`float` **stepify** **(** :ref:`float` s, :ref:`float` step **)** Snap float value to a given step. .. _class_@GDScript_str: - :ref:`String` **str** **(** :ref:`Variant` what, :ref:`Variant` ... **)** Convert one or more arguments to strings in the best way possible. .. _class_@GDScript_str2var: - :ref:`Variant` **str2var** **(** :ref:`String` string **)** Convert a formatted string that was returned by :ref:`var2str` to the original value. .. _class_@GDScript_tan: - :ref:`float` **tan** **(** :ref:`float` s **)** Standard tangent function. .. _class_@GDScript_tanh: - :ref:`float` **tanh** **(** :ref:`float` s **)** Hyperbolic tangent. .. _class_@GDScript_to_json: - :ref:`String` **to_json** **(** :ref:`Variant` var:Variant **)** Convert a Variant to json text. .. _class_@GDScript_type_exists: - :ref:`bool` **type_exists** **(** :ref:`String` type **)** .. _class_@GDScript_typeof: - :ref:`int` **typeof** **(** :ref:`Variant` what **)** Return the internal type of the given Variant object, using the TYPE\_\* enum in :ref:`@Global Scope`. .. _class_@GDScript_validate_json: - :ref:`Variant` **validate_json** **(** :ref:`String` json **)** .. _class_@GDScript_var2bytes: - :ref:`PoolByteArray` **var2bytes** **(** :ref:`Variant` var **)** Encode a variable value to a byte array. .. _class_@GDScript_var2str: - :ref:`String` **var2str** **(** :ref:`Variant` var **)** Convert a value to a formatted string that can later be parsed using :ref:`str2var`. .. _class_@GDScript_weakref: - :ref:`WeakRef` **weakref** **(** :ref:`Object` obj **)** Return a weak reference to an object. .. _class_@GDScript_yield: - :ref:`GDFunctionState` **yield** **(** :ref:`Object` object, :ref:`String` signal **)** Stop the function execution and return the current state. Call :ref:`GDFunctionState.resume` on the state to resume execution. This invalidates the state. Returns anything that was passed to the resume function call. If passed an object and a signal, the execution is resumed when the object's signal is emitted.