class_script.rst 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the Script.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_Script:
  5. Script
  6. ======
  7. **Inherits:** :ref:`Resource<class_resource>` **<** :ref:`Reference<class_reference>` **<** :ref:`Object<class_object>`
  8. **Inherited By:** :ref:`VisualScript<class_visualscript>`, :ref:`GDScript<class_gdscript>`, :ref:`CSharpScript<class_csharpscript>`, :ref:`NativeScript<class_nativescript>`, :ref:`PluginScript<class_pluginscript>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. A class stored as a resource.
  13. Member Functions
  14. ----------------
  15. +------------------------------+--------------------------------------------------------------------------------------------------------------------+
  16. | :ref:`bool<class_bool>` | :ref:`can_instance<class_Script_can_instance>` **(** **)** const |
  17. +------------------------------+--------------------------------------------------------------------------------------------------------------------+
  18. | :ref:`Script<class_script>` | :ref:`get_base_script<class_Script_get_base_script>` **(** **)** const |
  19. +------------------------------+--------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`String<class_string>` | :ref:`get_instance_base_type<class_Script_get_instance_base_type>` **(** **)** const |
  21. +------------------------------+--------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`bool<class_bool>` | :ref:`has_script_signal<class_Script_has_script_signal>` **(** :ref:`String<class_string>` signal_name **)** const |
  23. +------------------------------+--------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`bool<class_bool>` | :ref:`has_source_code<class_Script_has_source_code>` **(** **)** const |
  25. +------------------------------+--------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`bool<class_bool>` | :ref:`instance_has<class_Script_instance_has>` **(** :ref:`Object<class_object>` base_object **)** const |
  27. +------------------------------+--------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`bool<class_bool>` | :ref:`is_tool<class_Script_is_tool>` **(** **)** const |
  29. +------------------------------+--------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`int<class_int>` | :ref:`reload<class_Script_reload>` **(** :ref:`bool<class_bool>` keep_state=false **)** |
  31. +------------------------------+--------------------------------------------------------------------------------------------------------------------+
  32. Member Variables
  33. ----------------
  34. .. _class_Script_source_code:
  35. - :ref:`String<class_string>` **source_code** - The script source code, or an empty string if source code is not available. When set, does not reload the class implementation automatically.
  36. Description
  37. -----------
  38. A class stored as a resource. The script exends the functionality of all objects that instance it.
  39. The 'new' method of a script subclass creates a new instance. :ref:`Object.set_script<class_Object_set_script>` extends an existing object, if that object's class matches one of the script's base classes.
  40. Member Function Description
  41. ---------------------------
  42. .. _class_Script_can_instance:
  43. - :ref:`bool<class_bool>` **can_instance** **(** **)** const
  44. Returns true if the script can be instanced.
  45. .. _class_Script_get_base_script:
  46. - :ref:`Script<class_script>` **get_base_script** **(** **)** const
  47. Returns the script directly inherited by this script.
  48. .. _class_Script_get_instance_base_type:
  49. - :ref:`String<class_string>` **get_instance_base_type** **(** **)** const
  50. .. _class_Script_has_script_signal:
  51. - :ref:`bool<class_bool>` **has_script_signal** **(** :ref:`String<class_string>` signal_name **)** const
  52. Returns true if the script, or a base class, defines a signal with the given name.
  53. .. _class_Script_has_source_code:
  54. - :ref:`bool<class_bool>` **has_source_code** **(** **)** const
  55. Returns true if the script contains non-empty source code.
  56. .. _class_Script_instance_has:
  57. - :ref:`bool<class_bool>` **instance_has** **(** :ref:`Object<class_object>` base_object **)** const
  58. Returns true if 'base_object' is an instance of this script.
  59. .. _class_Script_is_tool:
  60. - :ref:`bool<class_bool>` **is_tool** **(** **)** const
  61. Returns true if the script is a tool script. A tool script can run in the editor.
  62. .. _class_Script_reload:
  63. - :ref:`int<class_int>` **reload** **(** :ref:`bool<class_bool>` keep_state=false **)**
  64. Reloads the script's class implementation. Returns an error code.