class_gdscript.rst 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/modules/gdscript/doc_classes/GDScript.xml.
  6. .. _class_GDScript:
  7. GDScript
  8. ========
  9. **Inherits:** :ref:`Script<class_Script>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. A script implemented in the GDScript programming language.
  11. Description
  12. -----------
  13. A script implemented in the GDScript programming language. The script extends the functionality of all objects that instance it.
  14. \ :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.
  15. Tutorials
  16. ---------
  17. - :doc:`GDScript documentation index <../tutorials/scripting/gdscript/index>`
  18. Methods
  19. -------
  20. +-----------------------------------------------+-------------------------------------------------------------------------------------+
  21. | :ref:`PackedByteArray<class_PackedByteArray>` | :ref:`get_as_byte_code<class_GDScript_method_get_as_byte_code>` **(** **)** |const| |
  22. +-----------------------------------------------+-------------------------------------------------------------------------------------+
  23. | :ref:`Variant<class_Variant>` | :ref:`new<class_GDScript_method_new>` **(** ... **)** |vararg| |
  24. +-----------------------------------------------+-------------------------------------------------------------------------------------+
  25. Method Descriptions
  26. -------------------
  27. .. _class_GDScript_method_get_as_byte_code:
  28. - :ref:`PackedByteArray<class_PackedByteArray>` **get_as_byte_code** **(** **)** |const|
  29. Returns byte code for the script source code.
  30. ----
  31. .. _class_GDScript_method_new:
  32. - :ref:`Variant<class_Variant>` **new** **(** ... **)** |vararg|
  33. Returns a new instance of the script.
  34. For example:
  35. ::
  36. var MyClass = load("myclass.gd")
  37. var instance = MyClass.new()
  38. assert(instance.get_script() == MyClass)
  39. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  40. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  41. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  42. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  43. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  44. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`