aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2019-11-05 16:49:50 +0100
committersfan5 <sfan5@live.de>2019-11-05 16:49:50 +0100
commit37cdbf014e7ae37a5ef5266deeafc560f700cacf (patch)
tree667235d6385b6ac3b8c942e3bd8456ff84cad30b
parente937f5ff67eaf1dc87f8d9b0502dd0825ed9b5bd (diff)
downloadxban2-37cdbf014e7ae37a5ef5266deeafc560f700cacf.tar.gz
xban2-37cdbf014e7ae37a5ef5266deeafc560f700cacf.tar.bz2
xban2-37cdbf014e7ae37a5ef5266deeafc560f700cacf.zip
Fix list of names in log message upon (un-)banning
-rw-r--r--init.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/init.lua b/init.lua
index 68a3508..09385bd 100644
--- a/init.lua
+++ b/init.lua
@@ -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
@@ -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
@@ -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