tables need to be serialized

This commit is contained in:
theFox6 2018-04-10 19:14:19 +02:00 committed by GitHub
parent 0cbbccc850
commit 182b51be93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -11,14 +11,14 @@ end
save_weather = function ()
local file = io.open(minetest.get_worldpath().."/weather", "w+")
file:write(weather)
file:write(minetest.serialize(weather))
file:close()
end
read_weather = function ()
local file = io.open(minetest.get_worldpath().."/weather", "r")
if not file then return {type = "none", wind = 0} end
local readweather = file:read()
local readweather = minetest.deserialize(file:read())
file:close()
if type(readweather)~="table" then
return {type = "none", wind = 0}