Skip to content

Commit

Permalink
Fix list of names in log message upon (un-)banning
Browse files Browse the repository at this point in the history
  • Loading branch information
sfan5 committed Nov 5, 2019
1 parent e937f5f commit 37cdbf0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ local function parse_time(t) --> secs
return secs
end

local function concat_keys(t, sep)
local keys = {}
for k, _ in pairs(t) do
keys[#keys + 1] = k
end
return table.concat(keys, sep)
end

function xban.find_entry(player, create) --> entry, index
for index, e in ipairs(db) do
for name in pairs(e.names) do
Expand Down Expand Up @@ -111,7 +119,7 @@ function xban.ban_player(player, source, expires, reason) --> bool, err
end
ACTION("%s bans %s until %s for reason: %s", source, player,
date, reason)
ACTION("Banned Names/IPs: %s", table.concat(e.names, ", "))
ACTION("Banned Names/IPs: %s", concat_keys(e.names, ", "))
return true
end

Expand All @@ -131,7 +139,7 @@ function xban.unban_player(player, source) --> bool, err
e.expires = nil
e.time = nil
ACTION("%s unbans %s", source, player)
ACTION("Unbanned Names/IPs: %s", table.concat(e.names, ", "))
ACTION("Unbanned Names/IPs: %s", concat_keys(e.names, ", "))
return true
end

Expand Down

0 comments on commit 37cdbf0

Please sign in to comment.