A Lua library that transforms any Lua value into a human-readable representation for debugging.
inspect.lua is a Lua library that converts any Lua value into a human-readable string representation. It solves the problem of debugging complex table structures by presenting them in a clear, formatted way that developers can easily understand, especially when dealing with nested or self-referential tables.
Lua developers who need to debug complex data structures, inspect table contents during development, or generate readable representations of Lua objects for logging or troubleshooting.
Developers choose inspect.lua because it provides a clean, customizable way to visualize Lua tables and values without the complexity of serialization libraries, with built-in cycle detection and flexible formatting options that adapt to different debugging scenarios.
Human-readable representation of Lua tables
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Automatically distinguishes between array-like and dictionary-like tables, rendering them horizontally or with line breaks for optimal readability, as shown in the hybrid table examples in the README.
Prevents infinite recursion by assigning IDs to repeated tables, essential for debugging circular references without crashing, demonstrated with self-referential table examples.
Offers options like depth limits, custom indentation, and process functions that allow filtering sensitive data, such as replacing passwords with 'XXXX', as detailed in the process function section.
Includes metatables in the output, helping developers inspect and debug meta-programming constructs directly, with examples showing metatable handling.
Explicitly not designed for saving or restoring tables, limiting its use in data persistence scenarios where libraries like cjson would be more appropriate.
The recursive formatting and cycle detection can introduce overhead, making it less suitable for real-time debugging in loops or with very large tables compared to simpler toString methods.
Tied specifically to Lua environments, so it cannot be used for cross-language data inspection or comparison, unlike JSON-based tools.