MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / to_string

Method to_string

modules/gdscript/gdscript.cpp:2116–2137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2114}
2115
2116String GDScriptInstance::to_string(bool *r_valid) {
2117 if (has_method(CoreStringName(_to_string))) {
2118 Callable::CallError ce;
2119 Variant ret = callp(CoreStringName(_to_string), nullptr, 0, ce);
2120 if (ce.error == Callable::CallError::CALL_OK) {
2121 if (ret.get_type() != Variant::STRING) {
2122 if (r_valid) {
2123 *r_valid = false;
2124 }
2125 ERR_FAIL_V_MSG(String(), "Wrong type for " + CoreStringName(_to_string) + ", must be a String.");
2126 }
2127 if (r_valid) {
2128 *r_valid = true;
2129 }
2130 return ret.operator String();
2131 }
2132 }
2133 if (r_valid) {
2134 *r_valid = false;
2135 }
2136 return String();
2137}
2138
2139Ref<Script> GDScriptInstance::get_script() const {
2140 return script;

Calls 5

has_methodFunction · 0.85
callpFunction · 0.85
StringClass · 0.50
get_typeMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected