From d12ff0d09e904cb92c868add30b0cf36acc68396 Mon Sep 17 00:00:00 2001 From: Ryan Phillips Date: Sat, 9 Sep 2017 17:46:52 -0700 Subject: [PATCH] Document the Script and GDScript classes --- doc/base/classes.xml | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/doc/base/classes.xml b/doc/base/classes.xml index a097470306f..ff1ed5d2646 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -19249,20 +19249,31 @@ + A script implemented in the GDScript programming language. + 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. + Returns byte code for the script source code. + 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] @@ -44435,17 +44446,18 @@ - Base class for scripts. + A class stored as a resource. - 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. - Return true if this script can be instance (ie not a library). + Returns true if the script can be instanced. @@ -44458,7 +44470,7 @@ - Return the script source code (if available). + Returns the script source code, or an empty string if source code is not available. @@ -44467,13 +44479,14 @@ + Returns true if the script, or a base class, defines a signal with the given name. - Return true if the script contains source code. + Returns true if the script contains non-empty source code. @@ -44482,21 +44495,24 @@ - Return true if a given object uses an instance of this script. + Returns true if 'base_object' is an instance of this script. + Returns true if the script is a tool script. A tool script can run in the editor. + If true, preserve existing script instances and subclasses. + Reloads the script's class implementation. Returns an error code. @@ -44505,7 +44521,7 @@ - Set the script source code. + Sets the script source code. Does not reload the class implementation.