I like this module: https://github.com/kikito/inspect.lua
luarocks install inspect
then import it as follows
local inspect = require 'inspect'
the output could be something like this:
assert(inspect(setmetatable({a=1}, {b=2}) == [[{
a = 1
<metatable> = {
b = 2
}
}]]))
general use:
print(inspect(myobj))
source
share