It's a single file in-game console that you can use for debugging your games. It's easy to integrate and doesn't take over your game loop or install any globals.
local console = require "console"
function love.keypressed(key, scancode, isrepeat)
console.keypressed(key, scancode, isrepeat)
end
function love.textinput(text)
console.textinput(text)
end
function love.draw()
console.draw()
end
-- This table is available as "player" in the console scope.
console.ENV.player = {x = 100, y = 5}
console.COMMANDS.save = function()
-- This function is run when the user types "save" into the console.
end
function love.keypressed(key, scancode, isrepeat)
if key == "f1" then
console.clear()
console.enable(not console.isEnabled())
end
console.keypressed(key, scancode, isrepeat)
end
Last edited by Xii on Thu Jun 10, 2021 2:18 am, edited 1 time in total.