summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorLeonard Meagher <leonardmeagher2@gmail.com>2019-04-09 22:07:40 -0700
committerLeonard Meagher <leonardmeagher2@gmail.com>2019-05-03 15:06:05 -0700
commitf7eb426e2ebafc5598b0e43baf37d9a50cea1648 (patch)
tree5dfda6e83e3b59b1a52923d7fead0aea4ff15ff2 /doc
parent5772f60f960ee8c396574f0c6f94def18bb210c7 (diff)
Allow overriding how scripted objects are converted to strings
solves #26796 - ADD `String to_string()` method to Object which can be overriden by `String _to_string()` in scripts - ADD `String to_string(r_valid)` method to ScriptInstance to allow langauges to control how scripted objects are converted to strings - IMPLEMENT to_string for GDScriptInstance, VisualScriptInstance, and NativeScriptInstance - ADD Documentation about `Object.to_string` and `Object._to_string` - Changed `Variant::operator String` to use `obj->to_string()`
Diffstat (limited to 'doc')
-rw-r--r--doc/classes/Object.xml16
1 files changed, 16 insertions, 0 deletions
diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml
index f76038fd69..42bea5e7f4 100644
--- a/doc/classes/Object.xml
+++ b/doc/classes/Object.xml
@@ -59,6 +59,22 @@
Sets a property. Returns [code]true[/code] if the [code]property[/code] exists.
</description>
</method>
+ <method name="_to_string" qualifiers="virtual">
+ <return type="String">
+ </return>
+ <description>
+ Returns a [String] representing the object. Default is [code]"[ClassName:RID]"[/code].
+ Override this method to customize the [String] representation of the object when it's being converted to a string, for example: [code]print(obj)[/code].
+ </description>
+ </method>
+ <method name="to_string">
+ <return type="String">
+ </return>
+ <description>
+ Returns a [String] representing the object. Default is [code]"[ClassName:RID]"[/code].
+ Override the method [method _to_string] to customize the [String] representation.
+ </description>
+ </method>
<method name="add_user_signal">
<return type="void">
</return>