tables need to be serialized
This commit is contained in:
parent
0cbbccc850
commit
182b51be93
|
@ -11,14 +11,14 @@ end
|
||||||
|
|
||||||
save_weather = function ()
|
save_weather = function ()
|
||||||
local file = io.open(minetest.get_worldpath().."/weather", "w+")
|
local file = io.open(minetest.get_worldpath().."/weather", "w+")
|
||||||
file:write(weather)
|
file:write(minetest.serialize(weather))
|
||||||
file:close()
|
file:close()
|
||||||
end
|
end
|
||||||
|
|
||||||
read_weather = function ()
|
read_weather = function ()
|
||||||
local file = io.open(minetest.get_worldpath().."/weather", "r")
|
local file = io.open(minetest.get_worldpath().."/weather", "r")
|
||||||
if not file then return {type = "none", wind = 0} end
|
if not file then return {type = "none", wind = 0} end
|
||||||
local readweather = file:read()
|
local readweather = minetest.deserialize(file:read())
|
||||||
file:close()
|
file:close()
|
||||||
if type(readweather)~="table" then
|
if type(readweather)~="table" then
|
||||||
return {type = "none", wind = 0}
|
return {type = "none", wind = 0}
|
||||||
|
|
Loading…
Reference in New Issue