class_gdscript.rst 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the GDScript.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_GDScript:
  5. GDScript
  6. ========
  7. **Inherits:** :ref:`Script<class_Script>` **<** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. A script implemented in the GDScript programming language.
  12. Methods
  13. -------
  14. +-------------------------------------------+-----------------------------------------------------------------------------------+
  15. | :ref:`PoolByteArray<class_PoolByteArray>` | :ref:`get_as_byte_code<class_GDScript_method_get_as_byte_code>` **(** **)** const |
  16. +-------------------------------------------+-----------------------------------------------------------------------------------+
  17. | :ref:`Object<class_Object>` | :ref:`new<class_GDScript_method_new>` **(** **)** vararg |
  18. +-------------------------------------------+-----------------------------------------------------------------------------------+
  19. Description
  20. -----------
  21. A script implemented in the GDScript programming language. The script exends the functionality of all objects that instance it.
  22. :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.
  23. Tutorials
  24. ---------
  25. - :doc:`../getting_started/scripting/gdscript/index`
  26. Method Descriptions
  27. -------------------
  28. .. _class_GDScript_method_get_as_byte_code:
  29. - :ref:`PoolByteArray<class_PoolByteArray>` **get_as_byte_code** **(** **)** const
  30. Returns byte code for the script source code.
  31. .. _class_GDScript_method_new:
  32. - :ref:`Object<class_Object>` **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)