diff options
author | Rubenwardy <anjayward@gmail.com> | 2013-11-06 18:38:55 +0000 |
---|---|---|
committer | Rubenwardy <anjayward@gmail.com> | 2013-11-06 18:38:55 +0000 |
commit | 6405b26d65a6289ada84fa21a604f1111ab8b86d (patch) | |
tree | b2d9b50c503443d108d1aed2a85fa890bef0389b /api.lua | |
parent | 773f7993203ee0d953bf019fd5e0f818e7008241 (diff) |
Move playerdata table around
Diffstat (limited to 'api.lua')
-rw-r--r-- | api.lua | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -8,7 +8,7 @@ function save_playerD() local file = io.open(minetest.get_worldpath().."/awards.txt", "w") if file then - file:write(minetest.serialize(player_data)) + file:write(minetest.serialize(awards.players)) file:close() end end @@ -26,7 +26,10 @@ end -- The global award namespace awards={} -player_data=load_playerD() +awards.players=load_playerD() +function awards.player(name) + return awards.players[player] +end -- A table of award definitions awards.def={} @@ -114,7 +117,7 @@ end -- award - the name of the award to give function awards.give_achievement(name,award) -- Access Player Data - local data=player_data[name] + local data=awards.players[name] -- Perform checks if not data then @@ -181,13 +184,13 @@ minetest.register_chatcommand("list_awards", { params = "", description = "list_awards: list your awards", func = function(name, param) - if not player_data[name] then + if not awards.players[name] then minetest.chat_send_player(name, "Unable to find your award listings!") end minetest.chat_send_player(name, name.."'s awards:") - for _, str in pairs(player_data[name].unlocked) do + for _, str in pairs(awards.players[name].unlocked) do minetest.chat_send_player(name, str); end end, |