Factorio Runtime DocsVersion 2.1.7

LuaDebugAdapter - Runtime Docs

ClassLuaDebugAdapternew

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)

  • tags :: Any? : Extra debug session tags, see also tags

Metatable methods may be used to customize debug views:

  • __tostring(self) -> string : Called when the object appears as a value.

  • __debugcounts(self) -> indexedVariables :: int32 , namedVariables :: int32 : Called when the object appears in a parent object's listing, to estimate the size of this object's listing, and enabled paged listing for large indexed objects.

  • __debugchildren(self, filters :: DebugVariablesFilter) -> array(DebugVariable) : Called when the object itself is opened for a debug listing. If __debugcounts was implemented, the client may choose to fetch Indexed and Named children separately, and Indexed children in pages as-needed for display. See also describe_field.

This class also provides debug session APIs, as the global object debugadapter in all stages.

Members

start_profile{show_hook_events?=…}

Start recording profiler timings. [...]

Start recording profiler timings. [...]

stop_profile()

Stop recording profiler timings and save to script_output.

Stop recording profiler timings and save to script_output.

describe_field(name, value) DebugVariable

Prepare a default debug view entry for a field, to assist in preparing custom listings.

Prepare a default debug view entry for a field, to assist in preparing custom listings.

tags :: R AnyBasic

The value from the tags property of the current session's launch request

The value from the tags property of the current session's launch request

valid :: R boolean

Is this object valid? [...]

Is this object valid? [...]

object_name :: R string

The class name of this object. [...]

The class name of this object. [...]

Methods

start_profile{show_hook_events?=…}

Start recording profiler timings. If there is a previous recording session running, it will be stopped first.

Parameters

Table (optional) with the following fields:
show_hook_events :: boolean?

Include events to indicate time spent in hooks

Include events to indicate time spent in hooks


stop_profile()

Stop recording profiler timings and save to script_output.


describe_field(name, value) → DebugVariable

Prepare a default debug view entry for a field, to assist in preparing custom listings.

Parameters

name :: string

The name of the field

The name of the field

value :: Any

The value of the field

The value of the field

Attributes

tags :: Read AnyBasic

The value from the tags property of the current session's launch request


valid :: Read boolean

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.


object_name :: Read string

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.

Fulltext search

Classes

Concepts

Events

Defines

Fulltext search for