class_gdscript.rst 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the GDScript.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_GDScript:
  6. GDScript
  7. ========
  8. **Inherits:** :ref:`Script<class_Script>` **<** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  9. A script implemented in the GDScript programming language.
  10. Description
  11. -----------
  12. A script implemented in the GDScript programming language. The script extends the functionality of all objects that instance it.
  13. :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.
  14. Tutorials
  15. ---------
  16. - :doc:`../tutorials/scripting/gdscript/index`
  17. Methods
  18. -------
  19. +-----------------------------------------------+-----------------------------------------------------------------------------------+
  20. | :ref:`PackedByteArray<class_PackedByteArray>` | :ref:`get_as_byte_code<class_GDScript_method_get_as_byte_code>` **(** **)** const |
  21. +-----------------------------------------------+-----------------------------------------------------------------------------------+
  22. | :ref:`Variant<class_Variant>` | :ref:`new<class_GDScript_method_new>` **(** ... **)** vararg |
  23. +-----------------------------------------------+-----------------------------------------------------------------------------------+
  24. Method Descriptions
  25. -------------------
  26. .. _class_GDScript_method_get_as_byte_code:
  27. - :ref:`PackedByteArray<class_PackedByteArray>` **get_as_byte_code** **(** **)** const
  28. Returns byte code for the script source code.
  29. ----
  30. .. _class_GDScript_method_new:
  31. - :ref:`Variant<class_Variant>` **new** **(** ... **)** vararg
  32. Returns a new instance of the script.
  33. For example:
  34. ::
  35. var MyClass = load("myclass.gd")
  36. var instance = MyClass.new()
  37. assert(instance.get_script() == MyClass)