Save database at shutdown.
This commit is contained in:
parent
25ad0e3200
commit
04ade2f8ff
1 changed files with 11 additions and 0 deletions
11
init.lua
11
init.lua
|
@ -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 = {}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue