Inspect
Based on game build 714014 | Last updated: 2026-03-10
Overview
inspect is a utility module that generates human-readable string representations of Lua tables. It handles circular references, metatables, and displays both array and dictionary parts of tables in a structured format. This component is typically used for debugging, logging, or development-time inspection of complex data structures.
Usage example
local inspect = require("inspect")
local my_table = { name = "Wes", inventory = {"apple", "match"}, meta = { version = 1 } }
print(inspect(my_table))
-- Output:
-- {
-- "apple",
-- "match",
-- name = "Wes",
-- meta = {
-- version = 1
-- }
-- }
Dependencies & tags
Components used: None identified
Tags: None identified
Properties
No public properties
Main functions
inspect(table, depth)
- Description: Returns a formatted, human-readable string representation of the given Lua table. Handles circular references, metatables, and type-specific display formatting.
- Parameters:
table(table) – The table to inspect.
depth(number, optional) – Maximum nesting depth to recurse into; omit or passnilfor unlimited depth. - Returns: (string) A string representation of the table.
- Error states: Handles errors gracefully via
pcallif a__tostringmetamethod throws; no exceptions thrown by this function.
Events & listeners
None identified