.. 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:`RawArray` bytes **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`ceil` **(** :ref:`float` s **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :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:`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:`bool` | :ref:`type_exists` **(** :ref:`String` type **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`typeof` **(** :ref:`Variant` what **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`RawArray` | :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. 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 **)** Returns the absolute value of parameter s (i.e. unsigned value, works for integer and float). .. _class_@GDScript_acos: - :ref:`float` **acos** **(** :ref:`float` s **)** Returns the principal value of the arc cosine of s, expressed in radians. In trigonometrics, arc cosine is the inverse operation of cosine. .. _class_@GDScript_asin: - :ref:`float` **asin** **(** :ref:`float` s **)** Returns the principal value of the arc sine of s, expressed in radians. In trigonometrics, arc sine is the inverse operation of sine. .. _class_@GDScript_assert: - void **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 **)** Returns the principal value of the arc tangent of s, expressed in radians. In trigonometrics, arc tangent is the inverse operation of tangent. Notice that because of the sign ambiguity, the function cannot determine with certainty in which quadrant the angle falls only by its tangent value. See :ref:`atan2` for an alternative that takes a fractional argument instead. .. _class_@GDScript_atan2: - :ref:`float` **atan2** **(** :ref:`float` x, :ref:`float` y **)** Returns the principal value of the arc tangent of y/x, expressed in radians. To compute the value, the function takes into account the sign of both arguments in order to determine the quadrant. .. _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 **)** Rounds s upward, returning the smallest integral value that is not less than s. .. _class_@GDScript_char: - :ref:`String` **char** **(** :ref:`int` ascii **)** .. _class_@GDScript_clamp: - :ref:`float` **clamp** **(** :ref:`float` val, :ref:`float` min, :ref:`float` max **)** Clamps a value between a minimum and maximum value. .. _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 **)** Returns the cosine of an angle of s radians. .. _class_@GDScript_cosh: - :ref:`float` **cosh** **(** :ref:`float` s **)** Returns the hyperbolic cosine of s. .. _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 **)** Returns the base-e exponential function of s, which is e raised to the power s: e^s. .. _class_@GDScript_floor: - :ref:`float` **floor** **(** :ref:`float` s **)** Rounds s downward, returning the largest integral value that is not greater than s. .. _class_@GDScript_fmod: - :ref:`float` **fmod** **(** :ref:`float` x, :ref:`float` y **)** Returns the floating-point remainder of x/y (rounded towards zero): :: fmod = x - tquot \* y Where tquot is the truncated (i.e., rounded towards zero) result 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:`Object` **funcref** **(** :ref:`Object` instance, :ref:`String` funcname **)** Return a reference to the specified function. .. _class_@GDScript_hash: - :ref:`int` **hash** **(** :ref:`Variant` var **)** 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_inverse_lerp: - :ref:`float` **inverse_lerp** **(** :ref:`float` from, :ref:`float` to, :ref:`float` value **)** .. _class_@GDScript_is_inf: - :ref:`float` **is_inf** **(** :ref:`float` s **)** Returns whether s is an infinity value (either positive infinity or negative infinity). .. _class_@GDScript_is_nan: - :ref:`float` **is_nan** **(** :ref:`float` s **)** Returns whether s is a NaN (Not-A-Number) value. .. _class_@GDScript_len: - :ref:`int` **len** **(** :ref:`Variant` var **)** .. _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:`Object` **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). Be aware that the JSON specification does not define integer or float types, but only a number type. Therefore, parsing a JSON text will convert every numerical values to :ref:`float` types. .. _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: - void **print** **(** **)** vararg Print one or more arguments to strings in the best way possible to a console line. .. _class_@GDScript_print_stack: - void **print_stack** **(** **)** Print a stack track at code location, only works when running with debugger turned on. .. _class_@GDScript_printerr: - void **printerr** **(** **)** vararg Print one or more arguments to strings in the best way possible to standard error line. .. _class_@GDScript_printraw: - void **printraw** **(** **)** vararg Print one or more arguments to strings in the best way possible to console. No newline is added at the end. .. _class_@GDScript_prints: - void **prints** **(** **)** vararg Print one or more arguments to the console with a space between each argument. .. _class_@GDScript_printt: - void **printt** **(** **)** vararg 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: - void **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** **(** **)** vararg 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_range_lerp: - :ref:`float` **range_lerp** **(** :ref:`float` value, :ref:`float` istart, :ref:`float` istop, :ref:`float` ostart, :ref:`float` ostop **)** .. _class_@GDScript_round: - :ref:`float` **round** **(** :ref:`float` s **)** Returns the integral value that is nearest to s, with halfway cases rounded away from zero. .. _class_@GDScript_seed: - void **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 **)** Returns the sine of an angle of s radians. .. _class_@GDScript_sinh: - :ref:`float` **sinh** **(** :ref:`float` s **)** Returns the hyperbolic sine of s. .. _class_@GDScript_sqrt: - :ref:`float` **sqrt** **(** :ref:`float` s **)** Returns the square root of s. .. _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** **(** **)** vararg Convert one or more arguments to string 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 **)** Returns the tangent of an angle of s radians. .. _class_@GDScript_tanh: - :ref:`float` **tanh** **(** :ref:`float` s **)** Returns the hyperbolic tangent of s. .. _class_@GDScript_to_json: - :ref:`String` **to_json** **(** :ref:`Variant` var **)** 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:`String` **validate_json** **(** :ref:`String` json **)** This method is used to validate the structure and data types of a piece of JSON, similar to XML Schema for XML. .. _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:`Object` **weakref** **(** :ref:`Object` obj **)** Return a weak reference to an object. A weak reference to an object is not enough to keep the object alive: when the only remaining references to a referent are weak references, garbage collection is free to destroy the referent and reuse its memory for something else. However, until the object is actually destroyed the weak reference may return the object even if there are no strong references to it. .. _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.