mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-11-11 04:50:17 +01:00
fix mana table load error
This commit is contained in:
parent
e272716ae6
commit
0984104080
|
@ -157,7 +157,7 @@ end
|
||||||
|
|
||||||
|
|
||||||
-- Load the playerlist from a previous session, if available.
|
-- Load the playerlist from a previous session, if available.
|
||||||
do
|
function mana.load_file()
|
||||||
local filepath = minetest.get_worldpath().."/mana.mt"
|
local filepath = minetest.get_worldpath().."/mana.mt"
|
||||||
local file = io.open(filepath, "r")
|
local file = io.open(filepath, "r")
|
||||||
if file then
|
if file then
|
||||||
|
@ -166,12 +166,17 @@ do
|
||||||
io.close(file)
|
io.close(file)
|
||||||
if(string ~= nil) then
|
if(string ~= nil) then
|
||||||
local savetable = minetest.deserialize(string)
|
local savetable = minetest.deserialize(string)
|
||||||
mana.playerlist = savetable.playerlist
|
if savetable and type(savetable) == "table" and savetable.playerlist and type(savetable.playerlist) == "table" then
|
||||||
minetest.log("action", "[mana] mana.mt successfully read.")
|
minetest.log("action", "[mana] mana.mt successfully read.")
|
||||||
|
return savetable.playerlist
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
return {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
mana.playerlist = mana.load_file()
|
||||||
|
|
||||||
function mana.save_to_file()
|
function mana.save_to_file()
|
||||||
local savetable = {}
|
local savetable = {}
|
||||||
savetable.playerlist = mana.playerlist
|
savetable.playerlist = mana.playerlist
|
||||||
|
|
Loading…
Reference in New Issue
Block a user