Simple Lua autosave

Currently completely untested. Submitting for comments or further development.