Merge pull request #11134 from notonfire/script-doc
Document the Script and GDScript classes
This commit is contained in:
commit
b259fcfbd3
1 changed files with 23 additions and 7 deletions
|
@ -19259,20 +19259,31 @@
|
|||
</class>
|
||||
<class name="GDScript" inherits="Script" category="Core">
|
||||
<brief_description>
|
||||
A script implemented in the GDScript programming language.
|
||||
</brief_description>
|
||||
<description>
|
||||
A script implemented in the GDScript programming language. The script exends the functionality of all objects that instance it.
|
||||
[method new] creates a new instance of the script. [method Object.set_script] extends an existing object, if that object's class matches one of the script's base classes.
|
||||
</description>
|
||||
<methods>
|
||||
<method name="get_as_byte_code" qualifiers="const">
|
||||
<return type="PoolByteArray">
|
||||
</return>
|
||||
<description>
|
||||
Returns byte code for the script source code.
|
||||
</description>
|
||||
</method>
|
||||
<method name="new" qualifiers="vararg">
|
||||
<return type="Object">
|
||||
</return>
|
||||
<description>
|
||||
Returns a new instance of the script.
|
||||
For example:
|
||||
[codeblock]
|
||||
var MyClass = load("myclass.gd")
|
||||
var instance = MyClass.new()
|
||||
assert(instance.get_script() == MyClass)
|
||||
[/codeblock]
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
|
@ -44449,17 +44460,18 @@
|
|||
</class>
|
||||
<class name="Script" inherits="Resource" category="Core">
|
||||
<brief_description>
|
||||
Base class for scripts.
|
||||
A class stored as a resource.
|
||||
</brief_description>
|
||||
<description>
|
||||
Base class for scripts. Any script that is loaded becomes one of these resources, which can then create instances.
|
||||
A class stored as a resource. The script exends the functionality of all objects that instance it.
|
||||
The 'new' method of a script subclass creates a new instance. [method Object.set_script] extends an existing object, if that object's class matches one of the script's base classes.
|
||||
</description>
|
||||
<methods>
|
||||
<method name="can_instance" qualifiers="const">
|
||||
<return type="bool">
|
||||
</return>
|
||||
<description>
|
||||
Return true if this script can be instance (ie not a library).
|
||||
Returns true if the script can be instanced.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_node_type" qualifiers="const">
|
||||
|
@ -44472,7 +44484,7 @@
|
|||
<return type="String">
|
||||
</return>
|
||||
<description>
|
||||
Return the script source code (if available).
|
||||
Returns the script source code, or an empty string if source code is not available.
|
||||
</description>
|
||||
</method>
|
||||
<method name="has_script_signal" qualifiers="const">
|
||||
|
@ -44481,13 +44493,14 @@
|
|||
<argument index="0" name="signal_name" type="String">
|
||||
</argument>
|
||||
<description>
|
||||
Returns true if the script, or a base class, defines a signal with the given name.
|
||||
</description>
|
||||
</method>
|
||||
<method name="has_source_code" qualifiers="const">
|
||||
<return type="bool">
|
||||
</return>
|
||||
<description>
|
||||
Return true if the script contains source code.
|
||||
Returns true if the script contains non-empty source code.
|
||||
</description>
|
||||
</method>
|
||||
<method name="instance_has" qualifiers="const">
|
||||
|
@ -44496,21 +44509,24 @@
|
|||
<argument index="0" name="base_object" type="Object">
|
||||
</argument>
|
||||
<description>
|
||||
Return true if a given object uses an instance of this script.
|
||||
Returns true if 'base_object' is an instance of this script.
|
||||
</description>
|
||||
</method>
|
||||
<method name="is_tool" qualifiers="const">
|
||||
<return type="bool">
|
||||
</return>
|
||||
<description>
|
||||
Returns true if the script is a tool script. A tool script can run in the editor.
|
||||
</description>
|
||||
</method>
|
||||
<method name="reload">
|
||||
<return type="int" enum="Error">
|
||||
</return>
|
||||
<argument index="0" name="keep_state" type="bool" default="false">
|
||||
If true, preserve existing script instances and subclasses.
|
||||
</argument>
|
||||
<description>
|
||||
Reloads the script's class implementation. Returns an error code.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_source_code">
|
||||
|
@ -44519,7 +44535,7 @@
|
|||
<argument index="0" name="source" type="String">
|
||||
</argument>
|
||||
<description>
|
||||
Set the script source code.
|
||||
Sets the script source code. Does not reload the class implementation.
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
|
|
Loading…
Reference in a new issue