pub struct LuaDebugAdapter;Expand description
Factorio provides a Debug Adapter for compatible tools in single-session mode on stdin/stdout when launched with the --dap command line argument.
The Debug Adapter supports a Launch request with the following arguments:
-
factorioArgs:: array[string]? : Command line arguments for the debug session -
followSymlinks:: boolean? : Follow symlinks when emitting locations (stack traces, etc) (default: true) -
hookDebugConsole:: boolean? : Enable catching errors and breakpoints/stepping in code called from the Debug Console (Evaluate context=“repl”) (default: false) -
trace:: boolean? : Trace DAP messages to adap-trace.log(default: false)
For mod objects that appear in debug listing, the following optional metatable methods may be used to customize their display:
-
__tostring(self) -> string : Called when the object appears as a value, to format it for inline display. -
__debugcounts(self) ->indexedVariables:: int32 ,namedVariables:: int32 : Called when the object appears as a value, to estimate the size of this object’s children, and enabled paged listing for large indexed objects. If either count is returned as 0, the client may skip listing that section entirely. If the indexed count is non-zero, the client may choose to request the values in pages. The Indexed count should indicate the highest index present, to properly range paged fetch windows, even if not all keys will be filled when fetched. -
__debugchildren(self,filters:: DebugVariablesFilter) -> array(DebugVariable) : Called when the object is expanded to list its children. If__debugcountswas implemented, the client may choose to fetch Indexed and Named children sections separately, and Indexed children in 0-based pages on-demand for display. If not all values in the requested page exist (such as a key0), they may be omitted from output entirely. See also describe_field.
This class also provides debug session APIs, as the global object debugadapter in all stages.
Implementations§
Source§impl LuaDebugAdapter
impl LuaDebugAdapter
Sourcepub fn object_name(&self) -> &'static str
pub fn object_name(&self) -> &'static str
The class name of this object. Available even when valid is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.
The value from the tags property of the current session’s launch request
Sourcepub fn valid(&self) -> bool
pub fn valid(&self) -> bool
Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be false. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.
Sourcepub fn describe_field(&self, name: &'static str, value: LuaAny) -> DebugVariable
pub fn describe_field(&self, name: &'static str, value: LuaAny) -> DebugVariable
Prepare a default debug view entry for a field, to assist in preparing custom listings.
Sourcepub fn start_profile(&self, params: LuaDebugAdapterStartProfileParams)
pub fn start_profile(&self, params: LuaDebugAdapterStartProfileParams)
Start recording profiler timings. If there is a previous recording session running, it will be stopped first.
Sourcepub fn stop_profile(&self)
pub fn stop_profile(&self)
Stop recording profiler timings and save to script_output.
Trait Implementations§
Source§impl Clone for LuaDebugAdapter
impl Clone for LuaDebugAdapter
Source§fn clone(&self) -> LuaDebugAdapter
fn clone(&self) -> LuaDebugAdapter
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more