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 print 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
boolstatustrue on successful execution, or false on failure

Examples

Print a simple table
local t = {a = 1, b = 2, c = 3}

engine.iprint(t)

--[[
Output:
{
    a: 1
    b: 2
    c: 3
}
]]
Print an array
local colors = {"red", "green", "blue"}

engine.iprint(colors)

--[[
Output:
{
    1: 'red'
    2: 'green'
    3: 'blue'
}
]]
Print with a depth limit
local deep = {a = {b = {c = {d = 1}}}}

engine.iprint(deep, false, 2) -- Shows only 2 levels deep
Debug a config table
local config = {width = 800, height = 600}

engine.iprint(config) -- Quick way to see table contents
Print primitive values
-- 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
iprint vs tostring for tables
local t = {x = 1, y = 2} -- Better than tostring for tables

engine.print(tostring(t)) -- 'table: 0x...'
engine.iprint(t) -- Readable format

On this page