Monocle



Monocleis a simple, but very helpful debugging library for Love2D.
Monocle can watch variables and expressions and keep them pinned to the top left of the screen.
If a problem occurs, the game will issue an error, but the watched expressions stay on the screen.
Best of all, the game will watch files and automatically reload the game when those files have been changed.

Basic implementation:

require 'monocle/monocle'
Monocle.new({})

-- The most basic way to watch any expression or variable:
Monocle.watch("FPS", function() return math.floor(1/love.timer.getDelta()) end)

function love.update(dt)
    Monocle.update()
end

function love.draw()
    Monocle.draw()
end

function love.textinput(t)
    Monocle.textinput(t)
end

function love.keypressed(text)
    Monocle.keypressed(text)
end

Monocle can also be started with options in mind that are tailored to your needs!

Monocle.new({       -- ALL of these parameters are optional!
   isActive=true,          -- Whether the debugger is initially active
   customPrinter=false,    -- Whether Monocle prints status messages to the output
   printColor = {51,51,51},-- Color to print with
   debugToggle='`',        -- The keyboard button for toggling Monocle
   filesToWatch=           -- Files that, when edited, cause the game to reload automatically
      {
         'main.lua'
      }
})


You can find it at [1].