2
0

class_gdscript.rst 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. **Category:** Core
  10. Brief Description
  11. -----------------
  12. A script implemented in the GDScript programming language.
  13. Methods
  14. -------
  15. +-------------------------------------------+-----------------------------------------------------------------------------------+
  16. | :ref:`PoolByteArray<class_PoolByteArray>` | :ref:`get_as_byte_code<class_GDScript_method_get_as_byte_code>` **(** **)** const |
  17. +-------------------------------------------+-----------------------------------------------------------------------------------+
  18. | :ref:`Object<class_Object>` | :ref:`new<class_GDScript_method_new>` **(** ... **)** vararg |
  19. +-------------------------------------------+-----------------------------------------------------------------------------------+
  20. Description
  21. -----------
  22. A script implemented in the GDScript programming language. The script exends the functionality of all objects that instance it.
  23. :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.
  24. Tutorials
  25. ---------
  26. - :doc:`../getting_started/scripting/gdscript/index`
  27. Method Descriptions
  28. -------------------
  29. .. _class_GDScript_method_get_as_byte_code:
  30. - :ref:`PoolByteArray<class_PoolByteArray>` **get_as_byte_code** **(** **)** const
  31. Returns byte code for the script source code.
  32. ----
  33. .. _class_GDScript_method_new:
  34. - :ref:`Object<class_Object>` **new** **(** ... **)** vararg
  35. Returns a new instance of the script.
  36. For example:
  37. ::
  38. var MyClass = load("myclass.gd")
  39. var instance = MyClass.new()
  40. assert(instance.get_script() == MyClass)