summaryrefslogtreecommitdiff
path: root/doc/base
diff options
context:
space:
mode:
authorRyan Phillips <ryan@notonfire.com>2017-09-09 17:46:52 -0700
committerRyan Phillips <ryan@notonfire.com>2017-09-10 11:16:15 -0700
commitd12ff0d09e904cb92c868add30b0cf36acc68396 (patch)
tree318c41e6c1415399ab0992fce9ea2c9cae182362 /doc/base
parentd1cb73b47a17de830d9474026ffa7b3587cfbc68 (diff)
Document the Script and GDScript classes
Diffstat (limited to 'doc/base')
-rw-r--r--doc/base/classes.xml30
1 files changed, 23 insertions, 7 deletions
diff --git a/doc/base/classes.xml b/doc/base/classes.xml
index a097470306..ff1ed5d264 100644
--- a/doc/base/classes.xml
+++ b/doc/base/classes.xml
@@ -19249,20 +19249,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>
@@ -44435,17 +44446,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">
@@ -44458,7 +44470,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">
@@ -44467,13 +44479,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">
@@ -44482,21 +44495,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">
@@ -44505,7 +44521,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>