Skip to main content

Debug API

The Debug API provides structured Lua-side diagnostics on both client and server.

These messages go through the script diagnostics pipeline:

  • client:
    • in-game debug console as LuaScriptClient
    • user://logs/clientscript.log
  • server:
    • server console
    • runtime/server_script.log

Visibility is filtered by debugscript level on the client and ScriptDebugLogLevel on the server.

Server operators can change the live server diagnostics level from the server console with:

debugscript
debugscript 0
debugscript 1
debugscript 2
debugscript 3

Functions​

Debug.Info(...)
Debug.Warn(...)
Debug.Error(...)
Debug.Output(message, level)
outputDebugString(message, level)

Levels​

  • 1 = error
  • 2 = warning
  • 3 = info

Debug.Output and outputDebugString default to level 3 when the level is omitted.

Examples​

Debug.Info("Loaded map:", activeMapId)
Debug.Warn("Missing spawnpoint for", tostring(playerId))
Debug.Error("Bake failed:", errorMessage)

Server-side example:

Debug.Info("debug script")

This is visible in the server console and runtime/server_script.log when the server debug level is 3.

outputDebugString("map editor attached", 3)
outputDebugString("invalid marker state", 2)
outputDebugString("bake aborted", 1)

Notes​

  • The current implementation tags diagnostics with the active resource name.
  • Script file/line extraction is basic and currently depends on Lua exception message shape.
  • Logger.Info/Warning/Error and print/warn still exist and are separate from this diagnostics API.