Skip to content

Latest commit

 

History

History
executable file
·
108 lines (92 loc) · 1.87 KB

README_EN.md

File metadata and controls

executable file
·
108 lines (92 loc) · 1.87 KB

Screenshot

Russian | English
Support lua5.4 and luajit

Overview

Module for pretty-printing tables and text, as well as for simple debugging using Lua's built-in debug methods. The main goal of the module is to replace print with a more advanced tool.

Screenshot

Installing

luarocks install pimp

Inspect Variables

p('Pimp Module!')
p(true, false, nil)
p(function() end)
p(io.stderr)
p(10000, math.pi)
p(0/0, -1/0, 1/0)

local test = function () end
p(function() end, test)

local co = coroutine.create(function() end)
p(co)

if box then
  p(box.NULL)
end

Inspect Tables

local table_name = p({
  name = "John",
  age = 30,
  city = "New York"
})

Inspect Functions

local function sum(a, b)
  p(a, b)
  return a + b
end

local result_sum = p(sum(10, 5))

Disable or Enable output

p:disable()
p('Hello')
p:enable()

p('World')

Change prefix

p:setPrefix({ prefix = 'INFO', sep = '|-> ' })
p('Wow! It\'s new prefix!')
p:resetPrefix()
INFO|-> file.lua:2: 'Wow! It's new preffix!': [length 22]

logging

p.log.trace('Trace message')
p.log.debug('Debug message')
p.log.info('Info message')
p.log.warn('Warn message')
p.log.error('Error message')
p.log.fatal('Fatal message')

Extensive configuration

p:resetPrefix()
p:disable()
p:enable()
p:globalDisable()
p:matchPath(str)
p:disableFullPath()
p:enableFullPath()
p:disableColor()
p:enableColor()
p:enableVisibility()
p:disableVisibility()
p:enableType()
p:disableType()
p:enableTableAddr()
p:disableTableAddr()
p:enableFullCallStack()
p:disableFullCallStack()
p.pp(t)
p:enableFindLocalName()
p:disableFindLocalName()
p:enableCallStackLadder()
p:disableCallStackLadder()