Module lua-nucleo.prettifier

Creates prettifier object for pretty-printing lua tables

This file is a part of lua-nucleo library

Info:

  • Copyright: lua-nucleo authors (see file COPYRIGHT for the license)

Functions

make_prettifier (indent, buffer, cols[, colors]) Prettifier factory.

Instance functions

increase_indent () Increase current indent level.
decrease_indent () Decrease current indent level.
separator () Add the separator.
optional_nl () Add optional new line.
terminating_sep () Add terminating separator.
table_start () Table start hook.
table_finish () Table finish hook.
key_start () Key start hook.
key_start () Value start hook.
key_value_finish () Key-value finish hook.
finished () Finalize.
key_finish () Key finish hook.
string_start () String start hook.
string_finish () String finish hook.
number_start () Number start hook.
number_finish () Number finish hook.
boolean_start () Boolean start hook.
boolean_finish () Boolean finish hook.
before_open_curly_brace () Before open curly brace hook.
before_closed_curly_brace () Before closed curly brace hook.
after_open_curly_brace () After open curly brace hook.
after_closed_curly_brace () After closed curly brace hook.


Functions

make_prettifier (indent, buffer, cols[, colors])
Prettifier factory.

Parameters:

  • indent string An indent string to be used.
  • buffer table Table to be used as a buffer.
  • cols number Maximum allowed length of single line.
  • colors table Optional color table. Specify if you want to define custom colors for various element of the output. Note: reset_color must always be specified. Available elements:
    • curly_braces: (string) string that will be inserted before curly braces
    • key: (string) string that will be inserted before table keys
    • boolean: (string) string that will be inserted before booleans
    • string: (string) string that will be inserted before strings
    • number: (string) string that will be inserted before numbers
    • reset_color: (string) string that will be inserted after the entity which has a defined color
    (optional)

Returns:

    prettifier_instance Prettifier instance.

Instance functions

increase_indent ()
Increase current indent level.

Returns:

    None
decrease_indent ()
Decrease current indent level.

Returns:

    None
separator ()
Add the separator.

Returns:

    None
optional_nl ()
Add optional new line.

Returns:

    None
terminating_sep ()
Add terminating separator.

Returns:

    None
table_start ()
Table start hook.

Returns:

    None
table_finish ()
Table finish hook.

Returns:

    None
key_start ()
Key start hook.

Returns:

    None
key_start ()
Value start hook.

Returns:

    None
key_value_finish ()
Key-value finish hook.

Returns:

    None
finished ()
Finalize.

Returns:

    None
key_finish ()
Key finish hook.

Returns:

    None
string_start ()
String start hook.

Returns:

    None
string_finish ()
String finish hook.

Returns:

    None
number_start ()
Number start hook.

Returns:

    None
number_finish ()
Number finish hook.

Returns:

    None
boolean_start ()
Boolean start hook.

Returns:

    None
boolean_finish ()
Boolean finish hook.

Returns:

    None
before_open_curly_brace ()
Before open curly brace hook.

Returns:

    None
before_closed_curly_brace ()
Before closed curly brace hook.

Returns:

    None
after_open_curly_brace ()
After open curly brace hook.

Returns:

    None
after_closed_curly_brace ()
After closed curly brace hook.

Returns:

    None
generated by LDoc 1.4.6 Last updated 2021-04-22 13:57:02