mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
C#: Implement ScriptInstance::to_string
Create a blacklist of methods that must not be generated. Includes: "to_string", "_to_string" and "_init".
This commit is contained in:
parent
9738ed567c
commit
04ebf294f3
4 changed files with 49 additions and 1 deletions
|
|
@ -1855,6 +1855,34 @@ void CSharpInstance::_call_notification(int p_notification) {
|
|||
}
|
||||
}
|
||||
|
||||
String CSharpInstance::to_string(bool *r_valid) {
|
||||
MonoObject *mono_object = get_mono_object();
|
||||
|
||||
if (mono_object == NULL) {
|
||||
if (r_valid)
|
||||
*r_valid = false;
|
||||
return String();
|
||||
}
|
||||
|
||||
MonoException *exc = NULL;
|
||||
MonoString *result = GDMonoUtils::object_to_string(mono_object, &exc);
|
||||
|
||||
if (exc) {
|
||||
GDMonoUtils::set_pending_exception(exc);
|
||||
if (r_valid)
|
||||
*r_valid = false;
|
||||
return String();
|
||||
}
|
||||
|
||||
if (result == NULL) {
|
||||
if (r_valid)
|
||||
*r_valid = false;
|
||||
return String();
|
||||
}
|
||||
|
||||
return GDMonoMarshal::mono_string_to_godot(result);
|
||||
}
|
||||
|
||||
Ref<Script> CSharpInstance::get_script() const {
|
||||
|
||||
return script;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue