Script

A class stored as a resource.

A script extends the functionality of all objects that instance it. The new method of a script subclass creates a new instance. GodotObject.setScript extends an existing object, if that object's class matches one of the script's base classes.

Members

Aliases

BaseClasses
alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses)
Undocumented in source.

Functions

canInstance
bool canInstance()

Returns true if the script can be instanced.

getBaseScript
Ref!Script getBaseScript()

Returns the script directly inherited by this script.

getInstanceBaseType
String getInstanceBaseType()

Returns the script's base type.

getPropertyDefaultValue
Variant getPropertyDefaultValue(String property)

Returns the default value of the specified property.

getScriptConstantMap
Dictionary getScriptConstantMap()

Returns a dictionary containing constant names and their values.

getScriptMethodList
Array getScriptMethodList()

Returns the list of methods in this Script.

getScriptPropertyList
Array getScriptPropertyList()

Returns the list of properties in this Script.

getScriptSignalList
Array getScriptSignalList()

Returns the list of user signals defined in this Script.

getSourceCode
String getSourceCode()
hasScriptSignal
bool hasScriptSignal(String signal_name)

Returns true if the script, or a base class, defines a signal with the given name.

hasSourceCode
bool hasSourceCode()

Returns true if the script contains non-empty source code.

instanceHas
bool instanceHas(GodotObject base_object)

Returns true if base_object is an instance of this script.

isTool
bool isTool()

Returns true if the script is a tool script. A tool script can run in the editor.

opAssign
typeof(null) opAssign(typeof(null) n)
opEquals
bool opEquals(Script other)
opEquals
bool opEquals(typeof(null) n)
reload
GodotError reload(bool keep_state)

Reloads the script's class implementation. Returns an error code.

setSourceCode
void setSourceCode(String source)
toHash
size_t toHash()

Mixins

__anonymous
mixin baseCasts
Undocumented in source.

Properties

sourceCode
String sourceCode [@property getter]
String sourceCode [@property setter]

The script source code or an empty string if source code is not available. When set, does not reload the class implementation automatically.

Static functions

_new
Script _new()

Construct a new instance of Script. Note: use memnew!Script instead.

Static variables

_classBindingInitialized
bool _classBindingInitialized;
Undocumented in source.

Structs

GDNativeClassBinding
struct GDNativeClassBinding
Undocumented in source.

Unions

__anonymous
union __anonymous
Undocumented in source.

Variables

_GODOT_internal_name
enum string _GODOT_internal_name;
Undocumented in source.

Mixed In Members

From mixin baseCasts

as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(ToRef) as()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(ToRef)
Undocumented in source.
opCast
void* opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
godot_object opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
bool opCast()
Undocumented in source. Be warned that the author may not have intended to support it.

Meta