Vital.sandbox
Engine

engine.iprint

Shared

Prints a human-readable representation of any value on engine's console


Syntax

local status = engine.iprint(value, show_hidden = false, depth_limit = 0)

Parameters

TypeNameDescription
anyvalueValue to be printed on console
boolshow_hiddenDetermines inspection depth:
• When true - includes hidden elements such as metatables in the output
• When false - displays only visible table contents
intdepth_limitMaximum nesting depth to display (0 = unlimited)

Returns

TypeNameDescription
boolstatusReturns true on successful execution, or false on failure

Examples

--Print simple table
local t = {a = 1, b = 2, c = 3}
engine.iprint(t)
--Output:
--{
--  a: 1
--  b: 2
--  c: 3
--}
--Print array
local colors = {"red", "green", "blue"}
engine.iprint(colors)
--Output:
--{
--  1: "red"
--  2: "green"
--  3: "blue"
--}
--Print with depth limit
local deep = {a = {b = {c = {d = 1}}}}
engine.iprint(deep, false, 2)
--Shows only 2 levels deep
--Debug variable
local config = {width = 800, height = 600}
engine.iprint(config)
--Quick way to see table contents
--Print string
engine.iprint("hello world") --"hello world"
--Print number
engine.iprint(42) --42
--Print with metatable visible
local t = {x = 10}
setmetatable(t, {__tostring = function() return "custom" end})
engine.iprint(t, true)
--Shows metatable when show_hidden = true
--Print empty table
local empty = {}
engine.iprint(empty) --{}
--Better than tostring for tables
local t = {x = 1, y = 2}
engine.print(tostring(t)) --table: 0x...
engine.iprint(t) --Readable format

On this page