Save database at shutdown.

This commit is contained in:
Duane 2016-06-28 13:10:04 -05:00
parent 25ad0e3200
commit 04ade2f8ff

View file

@ -115,6 +115,17 @@ end
--fun_caves.print_recipes() --fun_caves.print_recipes()
-- Attempt to save data at shutdown (as well as periodically).
minetest.register_on_shutdown(function()
local out = io.open(fun_caves.world..'/fun_caves_data.txt','w')
if out then
print('Fun Caves: Saving database at shutdown')
out:write(minetest.serialize(fun_caves.db))
out.close()
end
end)
local hunger_mod = minetest.get_modpath("hunger") local hunger_mod = minetest.get_modpath("hunger")
fun_caves.hunger_id = {} fun_caves.hunger_id = {}