From d7b3568eecae72974e07bb5ce0b191a77e3ad54b Mon Sep 17 00:00:00 2001 From: Tux Date: Sun, 21 Jun 2015 20:02:12 -0400 Subject: [PATCH] Slightly simplified the Lua code. --- src/main/resources/lua/server_to_players.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/resources/lua/server_to_players.lua b/src/main/resources/lua/server_to_players.lua index a3fdd97..6a20552 100644 --- a/src/main/resources/lua/server_to_players.lua +++ b/src/main/resources/lua/server_to_players.lua @@ -6,12 +6,10 @@ for _, proxy in ipairs(ARGV) do for _, player in ipairs(players) do local server = redis.call("HGET", "player:" .. player, "server") if server then - if serverToData[server] then - local data = serverToData[server] - data[#data + 1] = player - else + if not serverToData[server] then serverToData[server] = {player} end + table.insert(serverToData[server], player) end end end