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

Method format

core/object/script_backtrace.cpp:184–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182}
183
184String ScriptBacktrace::format(int p_indent_all, int p_indent_frames) const {
185 if (is_empty()) {
186 return String();
187 }
188
189 static const String space = String::chr(U' ');
190 String indent_all = space.repeat(p_indent_all);
191 String indent_frames = space.repeat(p_indent_frames);
192 String indent_total = indent_all + indent_frames;
193
194 String result = indent_all + language_name + " backtrace (most recent call first):";
195 for (int i = 0; i < (int)stack_frames.size(); i++) {
196 const StackFrame &stack_frame = stack_frames[i];
197 result += "\n" + indent_total + "[" + itos(i) + "] " + stack_frame.function;
198
199 if (!stack_frame.file.is_empty()) {
200 result += " (" + stack_frame.file + ":" + itos(stack_frame.line) + ")";
201 }
202 }
203
204 return result;
205}

Callers

nothing calls this directly

Calls 5

itosFunction · 0.85
repeatMethod · 0.80
sizeMethod · 0.65
StringClass · 0.50
is_emptyMethod · 0.45

Tested by

no test coverage detected