@rbxts/jsnatives
rawLog
Outputs values to the console directly using Lua's print
function without any additional formatting.
Signature
function rawLog(...args: unknown[]): void
Description
The console.rawLog
method prints values to the console using Lua's built-in print
function directly. Unlike console.log
, it doesn't apply any automatic formatting, inspection, or indentation to the output. This is useful when you need to output raw data or want to avoid the automatic object inspection.
Parameters
...args
: A list of values to output to the console without formatting. Can be of any type.
Return value
- None (void).
Examples
Basic usage
// Raw logging a stringconsole.rawLog("Hello world");// Outputs: Hello world
// Raw logging multiple valuesconsole.rawLog("Value:", 42);// Outputs: Value: 42
Comparing with console.log
// Create a complex objectconst player = { name: "Player1", level: 5, inventory: ["sword", "shield", "potion"]};
// Compare output formatsconsole.log("Player info:", player);// Outputs: Player info: { name: "Player1", level: 5, inventory: ["sword", "shield", "potion"] }// (with indentation and inspection)
console.rawLog("Player info:", player);// Outputs: Player info: table: 0x1234abcd// (direct print output without inspection)
Logging raw data
// Logging raw valuesconst binaryData = "01010101";console.rawLog("Binary data:", binaryData);// Outputs directly: Binary data: 01010101
// Logging numbersconsole.rawLog("Score:", 42, "Lives:", 3);// Outputs directly: Score: 42 Lives: 3