@rbxts/jsnatives



info

Outputs an informational message to the console, similar to log but with different styling.

Signature

function info(...args: unknown[]): void

Description

The console.info method prints one or more values to the console as informational messages. While functionally similar to console.info, it may be styled differently (typically blue or green text). It supports string formatting when the first argument is a string.

Parameters

Return value

Examples

Basic usage

// Logging a simple string
console.info("Hello world");
// Outputs: Hello world (with indentation)
// Logging with string formatting
console.info("Player %s has score %d", "Alex", 42);
// Outputs: Player Alex has score 42 (formatted string with indentation)
// Logging numbers without formatting
console.info(42);
// Outputs: 42 (with indentation)

String formatting

// Using string format specifiers (like Lua's string.format)
console.info("Pi is approximately %.2f", 3.14159);
// Outputs: Pi is approximately 3.14
// Multiple arguments
console.info("Player: %s, Level: %d, Active: %s", "John", 5, true);
// Outputs: Player: John, Level: 5, Active: true
// Percent sign
console.info("Progress: %d%%", 75);
// Outputs: Progress: 75%

Logging objects

// Logging an object (uses inspection)
const player = {
name: "PlayerOne",
level: 5,
health: 100,
inventory: ["sword", "shield", "potion"]
};
console.info(player);
// Outputs an inspected representation without indentation:
// {name: "PlayerOne", level: 5, health: 100, inventory: ["sword", "shield", "potion"]}

Logging arrays

// Logging an array
const items = ["apple", "banana", "orange"];
console.info(items);
// Outputs inspected array without indentation:
// ["apple", "banana", "orange"]