mirror of
https://github.com/TangentFoxy/inspect.lua.git
synced 2025-07-28 02:52:18 +00:00
newline & indent options
This commit is contained in:
18
README.md
18
README.md
@@ -124,6 +124,24 @@ assert(inspect(t5, {depth = 2}) == [[{
|
||||
|
||||
`options.depth` defaults to infinite (`math.huge`).
|
||||
|
||||
### options.newline & options.indent
|
||||
|
||||
These are the strings used by `inspect` to respectively add a newline and indent each level of a table.
|
||||
|
||||
By default, `options.newline` is `"\n"` and `options.indent` is `" "` (two spaces).
|
||||
|
||||
``` lua
|
||||
local t = {a={b=1}}
|
||||
|
||||
assert(inspect(t) == [[{
|
||||
a = {
|
||||
b = 1
|
||||
}
|
||||
}]])
|
||||
|
||||
assert(inspect(t, {newline='@', indent="++"}), "{@++a = {@++++b = 1@++}@}"
|
||||
```
|
||||
|
||||
### options.process
|
||||
|
||||
`options.process` is a function which allow altering the passed object before transforming it into a string.
|
||||
|
Reference in New Issue
Block a user