class_gdscript.rst 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/modules/gdscript/doc_classes/GDScript.xml.
  6. .. _class_GDScript:
  7. GDScript
  8. ========
  9. **Inherits:** :ref:`Script<class_Script>` **<** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  10. A script implemented in the GDScript programming language.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. A script implemented in the GDScript programming language. The script extends the functionality of all objects that instance it.
  15. \ :ref:`new<class_GDScript_method_new>` creates a new instance of the script. :ref:`Object.set_script<class_Object_method_set_script>` extends an existing object, if that object's class matches one of the script's base classes.
  16. .. rst-class:: classref-introduction-group
  17. Tutorials
  18. ---------
  19. - :doc:`../tutorials/scripting/gdscript/index`
  20. .. rst-class:: classref-reftable-group
  21. Methods
  22. -------
  23. .. table::
  24. :widths: auto
  25. +-------------------------------------------+-------------------------------------------------------------------------------------+
  26. | :ref:`PoolByteArray<class_PoolByteArray>` | :ref:`get_as_byte_code<class_GDScript_method_get_as_byte_code>` **(** **)** |const| |
  27. +-------------------------------------------+-------------------------------------------------------------------------------------+
  28. | :ref:`Variant<class_Variant>` | :ref:`new<class_GDScript_method_new>` **(** ... **)** |vararg| |
  29. +-------------------------------------------+-------------------------------------------------------------------------------------+
  30. .. rst-class:: classref-section-separator
  31. ----
  32. .. rst-class:: classref-descriptions-group
  33. Method Descriptions
  34. -------------------
  35. .. _class_GDScript_method_get_as_byte_code:
  36. .. rst-class:: classref-method
  37. :ref:`PoolByteArray<class_PoolByteArray>` **get_as_byte_code** **(** **)** |const|
  38. Returns byte code for the script source code.
  39. .. rst-class:: classref-item-separator
  40. ----
  41. .. _class_GDScript_method_new:
  42. .. rst-class:: classref-method
  43. :ref:`Variant<class_Variant>` **new** **(** ... **)** |vararg|
  44. Returns a new instance of the script.
  45. For example:
  46. ::
  47. var MyClass = load("myclass.gd")
  48. var instance = MyClass.new()
  49. assert(instance.get_script() == MyClass)
  50. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  51. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  52. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  53. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`