diff options
author | Leonard Meagher <leonardmeagher2@gmail.com> | 2019-04-09 22:07:40 -0700 |
---|---|---|
committer | Leonard Meagher <leonardmeagher2@gmail.com> | 2019-05-03 15:06:05 -0700 |
commit | f7eb426e2ebafc5598b0e43baf37d9a50cea1648 (patch) | |
tree | 5dfda6e83e3b59b1a52923d7fead0aea4ff15ff2 /core/variant.cpp | |
parent | 5772f60f960ee8c396574f0c6f94def18bb210c7 (diff) | |
download | redot-engine-f7eb426e2ebafc5598b0e43baf37d9a50cea1648.tar.gz |
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 'core/variant.cpp')
-rw-r--r-- | core/variant.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/variant.cpp b/core/variant.cpp index 6c54faf233..8ae0ef0695 100644 --- a/core/variant.cpp +++ b/core/variant.cpp @@ -1582,7 +1582,7 @@ Variant::operator String() const { }; }; #endif - return "[" + _get_obj().obj->get_class() + ":" + itos(_get_obj().obj->get_instance_id()) + "]"; + return _get_obj().obj->to_string(); } else return "[Object:null]"; |