:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/ScriptBacktrace.xml. .. _class_ScriptBacktrace: ScriptBacktrace =============== **Inherits:** :ref:`RefCounted` **<** :ref:`Object` A captured backtrace of a specific script language. .. rst-class:: classref-introduction-group Description ----------- **ScriptBacktrace** holds an already captured backtrace of a specific script language, such as GDScript or C#, which are captured using :ref:`Engine.capture_script_backtraces()`. See :ref:`ProjectSettings.debug/settings/gdscript/always_track_call_stacks` and :ref:`ProjectSettings.debug/settings/gdscript/always_track_local_variables` for ways of controlling the contents of this class. .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`format`\ (\ indent_all\: :ref:`int` = 0, indent_frames\: :ref:`int` = 4\ ) |const| | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_frame_count`\ (\ ) |const| | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_frame_file`\ (\ index\: :ref:`int`\ ) |const| | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_frame_function`\ (\ index\: :ref:`int`\ ) |const| | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_frame_line`\ (\ index\: :ref:`int`\ ) |const| | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_global_variable_count`\ (\ ) |const| | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_global_variable_name`\ (\ variable_index\: :ref:`int`\ ) |const| | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Variant` | :ref:`get_global_variable_value`\ (\ variable_index\: :ref:`int`\ ) |const| | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_language_name`\ (\ ) |const| | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_local_variable_count`\ (\ frame_index\: :ref:`int`\ ) |const| | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_local_variable_name`\ (\ frame_index\: :ref:`int`, variable_index\: :ref:`int`\ ) |const| | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Variant` | :ref:`get_local_variable_value`\ (\ frame_index\: :ref:`int`, variable_index\: :ref:`int`\ ) |const| | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_member_variable_count`\ (\ frame_index\: :ref:`int`\ ) |const| | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_member_variable_name`\ (\ frame_index\: :ref:`int`, variable_index\: :ref:`int`\ ) |const| | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Variant` | :ref:`get_member_variable_value`\ (\ frame_index\: :ref:`int`, variable_index\: :ref:`int`\ ) |const| | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_empty`\ (\ ) |const| | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Method Descriptions ------------------- .. _class_ScriptBacktrace_method_format: .. rst-class:: classref-method :ref:`String` **format**\ (\ indent_all\: :ref:`int` = 0, indent_frames\: :ref:`int` = 4\ ) |const| :ref:`🔗` Converts the backtrace to a :ref:`String`, where the entire string will be indented by ``indent_all`` number of spaces, and the individual stack frames will be additionally indented by ``indent_frames`` number of spaces. \ **Note:** Calling :ref:`Object.to_string()` on a **ScriptBacktrace** will produce the same output as calling :ref:`format()` with all parameters left at their default values. .. rst-class:: classref-item-separator ---- .. _class_ScriptBacktrace_method_get_frame_count: .. rst-class:: classref-method :ref:`int` **get_frame_count**\ (\ ) |const| :ref:`🔗` Returns the number of stack frames in the backtrace. .. rst-class:: classref-item-separator ---- .. _class_ScriptBacktrace_method_get_frame_file: .. rst-class:: classref-method :ref:`String` **get_frame_file**\ (\ index\: :ref:`int`\ ) |const| :ref:`🔗` Returns the file name of the call site represented by the stack frame at the specified index. .. rst-class:: classref-item-separator ---- .. _class_ScriptBacktrace_method_get_frame_function: .. rst-class:: classref-method :ref:`String` **get_frame_function**\ (\ index\: :ref:`int`\ ) |const| :ref:`🔗` Returns the name of the function called at the stack frame at the specified index. .. rst-class:: classref-item-separator ---- .. _class_ScriptBacktrace_method_get_frame_line: .. rst-class:: classref-method :ref:`int` **get_frame_line**\ (\ index\: :ref:`int`\ ) |const| :ref:`🔗` Returns the line number of the call site represented by the stack frame at the specified index. .. rst-class:: classref-item-separator ---- .. _class_ScriptBacktrace_method_get_global_variable_count: .. rst-class:: classref-method :ref:`int` **get_global_variable_count**\ (\ ) |const| :ref:`🔗` Returns the number of global variables (e.g. autoload singletons) in the backtrace. \ **Note:** This will be non-zero only if the ``include_variables`` parameter was ``true`` when capturing the backtrace with :ref:`Engine.capture_script_backtraces()`. .. rst-class:: classref-item-separator ---- .. _class_ScriptBacktrace_method_get_global_variable_name: .. rst-class:: classref-method :ref:`String` **get_global_variable_name**\ (\ variable_index\: :ref:`int`\ ) |const| :ref:`🔗` Returns the name of the global variable at the specified index. .. rst-class:: classref-item-separator ---- .. _class_ScriptBacktrace_method_get_global_variable_value: .. rst-class:: classref-method :ref:`Variant` **get_global_variable_value**\ (\ variable_index\: :ref:`int`\ ) |const| :ref:`🔗` Returns the value of the global variable at the specified index. \ **Warning:** With GDScript backtraces, the returned :ref:`Variant` will be the variable's actual value, including any object references. This means that storing the returned :ref:`Variant` will prevent any such object from being deallocated, so it's generally recommended not to do so. .. rst-class:: classref-item-separator ---- .. _class_ScriptBacktrace_method_get_language_name: .. rst-class:: classref-method :ref:`String` **get_language_name**\ (\ ) |const| :ref:`🔗` Returns the name of the script language that this backtrace was captured from. .. rst-class:: classref-item-separator ---- .. _class_ScriptBacktrace_method_get_local_variable_count: .. rst-class:: classref-method :ref:`int` **get_local_variable_count**\ (\ frame_index\: :ref:`int`\ ) |const| :ref:`🔗` Returns the number of local variables in the stack frame at the specified index. \ **Note:** This will be non-zero only if the ``include_variables`` parameter was ``true`` when capturing the backtrace with :ref:`Engine.capture_script_backtraces()`. .. rst-class:: classref-item-separator ---- .. _class_ScriptBacktrace_method_get_local_variable_name: .. rst-class:: classref-method :ref:`String` **get_local_variable_name**\ (\ frame_index\: :ref:`int`, variable_index\: :ref:`int`\ ) |const| :ref:`🔗` Returns the name of the local variable at the specified ``variable_index`` in the stack frame at the specified ``frame_index``. .. rst-class:: classref-item-separator ---- .. _class_ScriptBacktrace_method_get_local_variable_value: .. rst-class:: classref-method :ref:`Variant` **get_local_variable_value**\ (\ frame_index\: :ref:`int`, variable_index\: :ref:`int`\ ) |const| :ref:`🔗` Returns the value of the local variable at the specified ``variable_index`` in the stack frame at the specified ``frame_index``. \ **Warning:** With GDScript backtraces, the returned :ref:`Variant` will be the variable's actual value, including any object references. This means that storing the returned :ref:`Variant` will prevent any such object from being deallocated, so it's generally recommended not to do so. .. rst-class:: classref-item-separator ---- .. _class_ScriptBacktrace_method_get_member_variable_count: .. rst-class:: classref-method :ref:`int` **get_member_variable_count**\ (\ frame_index\: :ref:`int`\ ) |const| :ref:`🔗` Returns the number of member variables in the stack frame at the specified index. \ **Note:** This will be non-zero only if the ``include_variables`` parameter was ``true`` when capturing the backtrace with :ref:`Engine.capture_script_backtraces()`. .. rst-class:: classref-item-separator ---- .. _class_ScriptBacktrace_method_get_member_variable_name: .. rst-class:: classref-method :ref:`String` **get_member_variable_name**\ (\ frame_index\: :ref:`int`, variable_index\: :ref:`int`\ ) |const| :ref:`🔗` Returns the name of the member variable at the specified ``variable_index`` in the stack frame at the specified ``frame_index``. .. rst-class:: classref-item-separator ---- .. _class_ScriptBacktrace_method_get_member_variable_value: .. rst-class:: classref-method :ref:`Variant` **get_member_variable_value**\ (\ frame_index\: :ref:`int`, variable_index\: :ref:`int`\ ) |const| :ref:`🔗` Returns the value of the member variable at the specified ``variable_index`` in the stack frame at the specified ``frame_index``. \ **Warning:** With GDScript backtraces, the returned :ref:`Variant` will be the variable's actual value, including any object references. This means that storing the returned :ref:`Variant` will prevent any such object from being deallocated, so it's generally recommended not to do so. .. rst-class:: classref-item-separator ---- .. _class_ScriptBacktrace_method_is_empty: .. rst-class:: classref-method :ref:`bool` **is_empty**\ (\ ) |const| :ref:`🔗` Returns ``true`` if the backtrace has no stack frames. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)` .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)` .. |void| replace:: :abbr:`void (No return value.)`