You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
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()`
This commit is contained in:
@@ -173,6 +173,11 @@ public:
|
||||
virtual void call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount);
|
||||
virtual void call_multilevel_reversed(const StringName &p_method, const Variant **p_args, int p_argcount);
|
||||
virtual void notification(int p_notification) = 0;
|
||||
virtual String to_string(bool *r_valid) {
|
||||
if (r_valid)
|
||||
*r_valid = false;
|
||||
return String();
|
||||
}
|
||||
|
||||
//this is used by script languages that keep a reference counter of their own
|
||||
//you can make make Ref<> not die when it reaches zero, so deleting the reference
|
||||
|
||||
Reference in New Issue
Block a user