Category

Console

print, warn and the rconsole debug console window.

Pages in this category

In-game console

print and warn write to the in-game console (the Lua console in the ClickGUI).

print(...)

Joins its arguments with tabs. Normal level.

warn(...)

Warning level.

Errors from scripts are written at error level.

rconsole

A debug console that opens as its own window. It opens the first time you print to it or call rconsole.open(), and closes when the script stops. Alias: Console.

If the window is not available, lines go to the in-game console instead.

rconsole.name("My script")
rconsole.print("hello")
rconsole.warn("careful")
rconsole.error("something broke")

Long lines are wrapped at 76 characters and tabs become two spaces. The last 500 lines are kept in memory.

Printing

rconsole.print(...), rconsole.info(...)

Print the arguments joined with spaces, as info.

rconsole.warn(...)

Print as a warning.

rconsole.error(...), rconsole.err(...)

Print as an error.

rconsole.debug(...)

Print as debug, with a [debug] prefix.

rconsole.printf(format, ...)

Print string.format(format, ...).

rconsole.dump(value, depth = 3)

Print a readable view of any value. Tables are shown with sorted keys, cycles are marked <cycle>, and very deep tables are cut with {...}. Alias: rconsole.table.

rconsole.inspect(value, depth = 3)

Return that readable text as a string instead of printing it.

rconsole.hr(char = "-")

Print a line of 40 characters.

rconsole.blank()

Print an empty line.

Window

rconsole.name(title)

Opens the window if needed and sets its title. Alias: rconsole.title.

rconsole.open(), rconsole.close()

Open or close the window.

rconsole.show(on = true)

Show or hide the window.

rconsole.isOpen()

Returns true if the window is open.

rconsole.clear()

Clears the window and the history.

rconsole.mirror(on = true)

When on, every line is also copied to the in-game console.

Input

rconsole.input(prompt, timeout)

Shows an optional prompt, then waits for a line typed in the window and returns it. Returns nil if timeout seconds pass. The game keeps running while it waits.

rconsole.poll()

Returns a typed line if there is one, otherwise nil. Does not wait.

Filtering and formatting

rconsole.level(level)

Sets the minimum level shown: "debug", "info", "warn" or "error" (or a number from 0 to 3). With no argument, returns the current level number.

rconsole.timestamps(on = true)

Prefix every line with [seconds].

rconsole.group(title)

Prints an optional title and indents everything after it by two spaces.

rconsole.groupEnd()

Ends the most recent group.

Avoiding repeated output

rconsole.once(key, ...)

Prints only the first time it is called with that key. Returns true if it printed.

rconsole.every(key, seconds, ...)

Prints at most once every seconds for that key. Returns true if it printed.

rconsole.watch(label, value)

Prints label = value only when the value has changed since the last call. Returns true if it printed.

RunService.Heartbeat:Connect(function()
  local p = mc.getPlayer()
  if p then
    rconsole.watch("onGround", p.onGround)
  end
end)

Counting and timing

rconsole.count(label = "count")

Adds one to a counter, prints label: n, and returns n.

rconsole.countReset(label = "count")

Resets a counter.

rconsole.time(label = "timer")

Starts a timer.

rconsole.timeEnd(label = "timer")

Stops the timer, prints the elapsed milliseconds and returns them. If no such timer exists, prints a warning and returns nil.

rconsole.measure(label, f, ...)

Runs f(...), prints how long it took, and returns what f returned. If f errors, it prints the error and then raises it again.

Checking and errors

rconsole.assert(condition, ...)

If the condition is false, prints assertion failed: ... as an error. Returns the condition. It does not stop the script.

rconsole.try(f, ...)

Runs f(...). On success returns its results. On an error, prints the message and returns nil, message.

Loggers

rconsole.logger(name)

Returns a logger whose lines all start with [name] .

local log = rconsole.logger("aura")
log.info("started")
log.warn("no target")
log.dump({ range = 4 })

A logger has print, info, warn, error, err, debug, printf(format, ...) and dump(value, depth).

History

rconsole.history(count)

Returns the last count lines (all, if omitted) as an array of strings.

rconsole.save(path = "console.log")

Writes the history to a file in the workspace. Returns the result of a protected call: true, or false and the error.

In this category