1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-24 17:50:37 +01:00

fix mana table load error

This commit is contained in:
crabman77 2015-08-05 23:29:22 +02:00
parent e272716ae6
commit 0984104080

View File

@ -157,7 +157,7 @@ end
-- Load the playerlist from a previous session, if available.
do
function mana.load_file()
local filepath = minetest.get_worldpath().."/mana.mt"
local file = io.open(filepath, "r")
if file then
@ -166,12 +166,17 @@ do
io.close(file)
if(string ~= nil) then
local savetable = minetest.deserialize(string)
mana.playerlist = savetable.playerlist
minetest.log("action", "[mana] mana.mt successfully read.")
if savetable and type(savetable) == "table" and savetable.playerlist and type(savetable.playerlist) == "table" then
minetest.log("action", "[mana] mana.mt successfully read.")
return savetable.playerlist
end
end
end
return {}
end
mana.playerlist = mana.load_file()
function mana.save_to_file()
local savetable = {}
savetable.playerlist = mana.playerlist