Skip to main content

Console

Per-runtime console buffer. The dashboard's "Console" pane reads from the same ConsoleHandle, so anything pushed here surfaces in the UI in real time. FIFO-evicted at 2 000 entries by default to bound memory for long-running scripts.

local client = getClient()
local console = client:console() -- or getConsole()

console:clear()
console:add("your own message") -- same as print(...)

for i, entry in pairs(console.entries) do
print("{} {} {}", entry.timestamp, entry.type, entry.content)
end

Constructors

getConsole()

FieldType
Signature() → Console
ReturnsConsole — runtime's shared console handle
Asyncno

Doesn't require a parent client.

client:console()

FieldType
Signature(self: Client) → Console
ReturnsConsole — same buffer getConsole() reads from
Asyncno

Fields

console.entries

FieldType
SignatureConsole.entries: {ConsoleEntry}
Returns{ConsoleEntry} — 1-indexed snapshot of every entry currently in the buffer

Snapshot at access time — re-read to see new pushes.

for i, entry in pairs(console.entries) do
print(entry.timestamp, entry.type, entry.content)
end

Methods

console:clear()

FieldType
Signature(self: Console) → ()
Returnsnothing
Asyncno

Wipe every entry. Used by the dashboard's "Clear" button and by :scripting():execute() between runs (fresh runtime, fresh console).

console:add(msg)

FieldType
Signature(self: Console, msg: string) → ()
Returnsnothing
Asyncno

Push a single "info"-tagged entry. Equivalent to print(msg) but without the multi-arg join — pass the already-formatted string.

ConsoleEntry fields

FieldTypeNotes
timestampnumberWall-clock epoch milliseconds when the entry was pushed.
typestringFree-form tag — "info" for print() and console:add(), "error" for raised errors.
contentstringRendered content as a single string. Multi-arg print(a, b, c) already gets joined upstream.

print(...)

FieldType
Signature(...: any) → ()
Returnsnothing
Asyncno

Override of Lua's stock print. Pushes one "info"-tagged entry to the runtime console — same buffer getConsole() and getLogs() read from. No stdout output.

{} placeholders in the first string argument get interpolated with the remaining args:

print("walked to {} {} in {}s", x, y, elapsed)

When no {} placeholders are present, args are space-joined via tostring() — same convention as Lua's built-in print.