From c8c83fb4b1ddde01b26ab8dcfbf2f1e8f53c5813 Mon Sep 17 00:00:00 2001 From: Luke aka SwissalpS Date: Tue, 17 Sep 2024 11:46:19 +0200 Subject: [PATCH] standardize var name and reduce looping --- init.lua | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/init.lua b/init.lua index 1c4c959..3d89cc8 100644 --- a/init.lua +++ b/init.lua @@ -280,18 +280,16 @@ function cc.info(player_name, params) if not facts[faction_name] then return false, S("Faction @1 doesn't exist.", faction_name) else - local fmembers = {} + local faction_members if table.getn(facts[faction_name].members) > factions.max_members_list then - table.insert(fmembers, S("The faction has more than @1 members," - .. " the members list can't be shown.", factions.max_members_list)) + faction_members = { S("The faction has more than @1 members," + .. " the members list can't be shown.", factions.max_members_list) } else - for play in pairs(facts[faction_name].members) do - table.insert(fmembers, play) - end + faction_members = facts[faction_name].members end local summary = S("Name: @1\nOwner: @2\nMembers: @3", faction_name, factions.get_owner(faction_name), - table.concat(fmembers, ", ")) + table.concat(faction_members, ", ")) return true, summary end end