1
0
mirror of https://gitlab.com/rubenwardy/awards.git synced 2024-11-16 23:50:27 +01:00

Fix conversion error

This commit is contained in:
rubenwardy 2018-04-04 21:04:54 +01:00
parent f571f9d6eb
commit f84e6d8db5

View File

@ -30,7 +30,9 @@ end
local function convert_data() local function convert_data()
minetest.log("warning", "Importing awards data from previous version") minetest.log("warning", "Importing awards data from previous version")
for name, data in pairs(awards.players) do local old_players = awards.players
awards.players = {}
for name, data in pairs(old_players) do
while name.name do while name.name do
name = name.name name = name.name
end end
@ -76,7 +78,11 @@ local function convert_data()
data[from] = nil data[from] = nil
data[to] = ret data[to] = ret
end end
awards.players[name] = data
end end
print(dump(awards.players))
end end
function awards.load() function awards.load()
@ -92,6 +98,7 @@ function awards.load()
end end
file:close() file:close()
os.rename(old_save_path, minetest.get_worldpath().."/awards.bk.txt") os.rename(old_save_path, minetest.get_worldpath().."/awards.bk.txt")
awards.save()
else else
awards.players = minetest.parse_json(storage:get_string("player_data")) or {} awards.players = minetest.parse_json(storage:get_string("player_data")) or {}
end end