summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2018-04-04 21:04:54 +0100
committerrubenwardy <rw@rubenwardy.com>2018-04-04 21:04:54 +0100
commitf84e6d8db5fa9f5c068432a9c3100f55d3188f51 (patch)
tree171fb408c928e6fea36d38f4e39c540c0b4f8dc8
parentf571f9d6eb7b11dc003aaf6c0a19b9db40ad356e (diff)
Fix conversion error
-rw-r--r--api.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/api.lua b/api.lua
index b19daf9..a4c7a3e 100644
--- a/api.lua
+++ b/api.lua
@@ -30,7 +30,9 @@ end
local function convert_data()
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
name = name.name
end
@@ -76,7 +78,11 @@ local function convert_data()
data[from] = nil
data[to] = ret
end
+
+ awards.players[name] = data
end
+
+ print(dump(awards.players))
end
function awards.load()
@@ -92,6 +98,7 @@ function awards.load()
end
file:close()
os.rename(old_save_path, minetest.get_worldpath().."/awards.bk.txt")
+ awards.save()
else
awards.players = minetest.parse_json(storage:get_string("player_data")) or {}
end