I created a module that lets you reload your code on the fly without stopping your game. The code is on github
To set up a project to be hotloadable:
main.lua:
Code: Select all
require('module').load('game')
Code: Select all
local Module = require('module')
function M.hotload(prevState)
val = 'hello'
end
function M.draw()
love.graphics.print(val)
end
function M.keyreleased(key)
if key == 'r' then
Module.hotload()
end
end
return M
There's a more detailed example in the repo.