Skip to content

Trace

A Trace object is used to capture and inspect feedback messages generated by command execution. When passed to spell:execute or bot:execute, any textual output from the command will be collected into the trace.

Example: Read the game time

local trace = Trace()
spell:executeSilent("/time query gametime", trace)
print(trace.content)

Fields

content: string? — Read-Only

The concatenated output messages if collected; nil if empty.

Methods

new() → trace: Trace

Creates and returns a new Trace instance for capturing command feedback.

Example

local trace = Trace:new()
spell:execute("/data get entity @p", trace)
print("Command output:\n" .. trace.content)

Returns

  • trace: Trace — A new, empty Trace object.

Trace() → trace: Trace

Convenient constructor for creating a new Trace. Equivalent to Trace:new().

Example

local trace = Trace()
spell:execute("/data get entity @p", trace)
print("Command output:\n" .. trace.content)

Returns

  • trace: Trace — A new, empty Trace object.