#
hs.inspect
Produce human-readable representations of Lua variables (particularly tables)
This extension is based on inspect.lua by Enrique García Cota https://github.com/kikito/inspect.lua
#
API Overview
Functions - API calls offered directly by the extension
inspect
#
API Documentation
#
Functions
#
inspect
| | |
| --------------------------------------------|-------------------------------------------------------------------------------------|
| Signature | hs.inspect.inspect(variable[, options]) -> string |
| Type | Function |
| Description | Gets a human readable version of the supplied Lua variable |
| Parameters |
- variable - A lua variable of some kind
- options - An optional table which can be used to influence the inspector. Valid keys are as follows:
depth - A number representing the maximum depth to recurse into
variable. Below that depth, data will be displayed as{...}newline - A string to use for line breaks. Defaults to\nindent - A string to use for indentation. Defaults to(two spaces) process - A function that will be called for each item. It should accept two arguments,item(the current item being processed) andpath(the item's position in the variable being inspected. The function should either return a processed form of the variable, the original variable itself if it requires no processing, ornilto remove the item from the inspected output. metatables - Iftrue, include (and traverse) metatables
- A string containing the human readable version of
variable
- For convenience, you can call this function as
hs.inspect(variable) - To view the output in Hammerspoon's Console, use
print(hs.inspect(variable)) - For more information on the options, and some examples, see the upstream docs