Simple Lua autosave

Currently completely untested. For comments or further development.