12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
- .. DO NOT EDIT THIS FILE, but the int.xml source instead.
- .. The source is found in doc/classes or modules/<name>/doc_classes.
- .. _class_int:
- int
- ===
- **Category:** Built-In Types
- Brief Description
- -----------------
- Integer built-in type.
- Member Functions
- ----------------
- +------------------------+------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`int<class_int_int>` **(** :ref:`bool<class_bool>` from **)** |
- +------------------------+------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`int<class_int_int>` **(** :ref:`float<class_float>` from **)** |
- +------------------------+------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`int<class_int_int>` **(** :ref:`String<class_string>` from **)** |
- +------------------------+------------------------------------------------------------------------+
- Description
- -----------
- Integer built-in type.
- Member Function Description
- ---------------------------
- .. _class_int_int:
- - :ref:`int<class_int>` **int** **(** :ref:`bool<class_bool>` from **)**
- Cast a :ref:`bool<class_bool>` value to an integer value, ``int(true)`` will be equals to 1 and ``int(false)`` will be equals to 0.
- .. _class_int_int:
- - :ref:`int<class_int>` **int** **(** :ref:`float<class_float>` from **)**
- Cast a float value to an integer value, this method simply removes the number fractions, so for example ``int(2.7)`` will be equals to 2, ``int(.1)`` will be equals to 0 and ``int(-2.7)`` will be equals to -2.
- .. _class_int_int:
- - :ref:`int<class_int>` **int** **(** :ref:`String<class_string>` from **)**
- Cast a :ref:`String<class_string>` value to an integer value, this method is an integer parser from a string, so calling this method with an invalid integer string will return 0, a valid string will be something like ``'1.7'``. This method will ignore all non-number characters, so calling ``int('1e3')`` will return 13.
|