Skip to content
Jérôme Leclercq edited this page Dec 8, 2020 · 2 revisions

API: pprint

Description:

Prints its parameter to the execution output in a pretty way.

This function does the same as print but is able to pretty-print tables.

Prototype:

pprint(...)

Parameters:

  1. ...: Variadic parameters to print.

Remarks:

  1. This function takes variadic parameters, which means it can take from 0 to n parameters.
  2. All parameters are converted to string as if tostring (with the second parameter set to true) was called on them before passing them to this function.
  3. When called with more than one argument, each printed argument will be separated by a tabulation (\t character)

Example code

-- Prints "Hello world" to the output
pprint("Hello world")

-- Prints "true 1.24 str vec2(10, 20)" to the output
pprint(true, 1.24, "str", Vec2(10, 20))

--[[ 
Prints the table content:
{
	1 = Hello
	2 = World
	key = value
}
]]
pprint({ "Hello", "World", key = "value" })

Clone this wiki locally