From 90612fa98a4d55485ad9b6e799af0a627f487acd Mon Sep 17 00:00:00 2001 From: Tux Date: Sun, 21 Jun 2015 20:44:44 -0400 Subject: [PATCH] Extra Lua optimizations (minimize table lookups). --- src/main/resources/lua/server_to_players.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/resources/lua/server_to_players.lua b/src/main/resources/lua/server_to_players.lua index 0fa7264..3f71791 100644 --- a/src/main/resources/lua/server_to_players.lua +++ b/src/main/resources/lua/server_to_players.lua @@ -9,10 +9,12 @@ for _, proxy in ipairs(ARGV) do for _, player in ipairs(players) do local server = call("HGET", "player:" .. player, "server") if server then - if not serverToData[server] then + local map = serverToData[server] + if not map then serverToData[server] = {} + map = serverToData[server] end - insert(serverToData[server], player) + insert(map, player) end end end