Skip to content

nenofite/mm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

37 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

mm: a delicious Lua inspector

I <3 mm!

Quickly understand your Lua data in a beautiful, tasty way.

some delicious output from mm

mm writes beautifully indented and color-coded representations of Lua data so that you can quickly and clearly understand what's going on. mm doesn't bore you with table memory addresses. Instead, mm gives each table a friendly, memorable name, so you can instantly make sense of what points where.

Features

  • Human-friendly, color-coded names for cyclical and redundant references.
  • Syntax highlighting.
  • Indentation and wrapping to fit nicely in a terminal.
  • Easily extended to present custom data types.
  • 100% delicious.

mm is not a serializer

There already exist many great serializers for Lua, which do amazing jobs of displaying Lua values in nicely-indented Lua syntax while handling messy tables, detecting cyclical references, and making you a cup of coffee on the side. These tools output Lua syntax, so you can stick the result back into a Lua interpreter and produce the same value.

That's not what mm does. The goal of mm is to produce comfortable, easily-understood, human-friendly output. By parting with the Lua syntax, mm can output values in a much friendlier way. That's why it's an inspector, not a serializer.

Install mm

To install with LuaRocks:

$ sudo luarocks install mm

Or just copy and paste the file mm.min.lua into your Lua REPL for a quick fix.

How to use mm

mm is easy to use; it's just one function. Simply pass the function any Lua value to have it printed.

For a one-line demo:

require 'mm' (_G)

Some other fun things to try:

mm = require 'mm'

a = { [{ "key" }] = "value" }
a.a = a
a.long_string = "ba" .. string.rep("na", 100)
setmetatable(a, a)
mm(a)

mm(mm)

f = function() end
mm({ f, f, f })

About

πŸ’πŸͺ🍰 A delicious Lua inspector

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages