From 6ca603418608debc341767efdb6eb56bc6d6a708 Mon Sep 17 00:00:00 2001 From: Simon Brodtmann Date: Wed, 12 Nov 2025 00:31:56 +0100 Subject: [PATCH] Add table.filterKey --- cf-lib/util/table.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cf-lib/util/table.lua b/cf-lib/util/table.lua index 865d683..57c7fa2 100644 --- a/cf-lib/util/table.lua +++ b/cf-lib/util/table.lua @@ -70,6 +70,18 @@ function table.filter(target, predicate) return result end +--- Filters a table by removing given key. +--- @param target table The table to filter +--- @param key string The key to remove +function table.filterKey(target, key) + return table.filter( + target, + function(_, currentKey) + return currentKey ~= key + end + ) +end + --- Concatenates two tables into a new table. --- @param table1 table The first table --- @param table2 table The second table