class_gdscript.rst 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. Member Functions
  13. ----------------
  14. +--------------------------------------------+----------------------------------------------------------------------------+
  15. | :ref:`PoolByteArray<class_poolbytearray>` | :ref:`get_as_byte_code<class_GDScript_get_as_byte_code>` **(** **)** const |
  16. +--------------------------------------------+----------------------------------------------------------------------------+
  17. | :ref:`Object<class_object>` | :ref:`new<class_GDScript_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_new>` creates a new instance of the script. :ref:`Object.set_script<class_Object_set_script>` extends an existing object, if that object's class matches one of the script's base classes.
  23. Member Function Description
  24. ---------------------------
  25. .. _class_GDScript_get_as_byte_code:
  26. - :ref:`PoolByteArray<class_poolbytearray>` **get_as_byte_code** **(** **)** const
  27. Returns byte code for the script source code.
  28. .. _class_GDScript_new:
  29. - :ref:`Object<class_object>` **new** **(** **)** vararg
  30. Returns a new instance of the script.
  31. For example:
  32. ::
  33. var MyClass = load("myclass.gd")
  34. var instance = MyClass.new()
  35. assert(instance.get_script() == MyClass)