← Back to Documentation
Console API
⚠️ Experimental - Pre-Release
The Console API provides methods for logging and debugging output. Use these methods to print messages, warnings, errors, and info.
Methods
Console.print(message: string) / Console.log(message: string)
Prints a message to the console.
Console.print("Hello, World!")Console.log("This is a log message")Console.warn(message: string) / Console.print_warn(message: string)
Prints a warning message to the console.
Console.warn("This is a warning")
Console.print_warn("Low health!")Console.error(message: string) / Console.print_error(message: string)
Prints an error message to the console.
Console.error("Something went wrong!")Console.print_error("Failed to load texture")Console.info(message: string) / Console.print_info(message: string)
Prints an info message to the console.
Console.info("Game started")Console.print_info("Player joined")Usage Example
@script Player extends Sprite2D var health = 100 fn init() { Console.print("Player initialized") } fn take_damage(amount: int) { health -= amount if health <= 0 { Console.error("Player died!") } else if health < 30 { Console.warn("Low health: " + health) } else { Console.info("Health: " + health) } }