newline & indent options

This commit is contained in:
kikito
2014-09-13 12:33:20 +02:00
parent 9054ee1051
commit 99e8c03959
3 changed files with 39 additions and 1 deletions

View File

@@ -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.