diff --git a/mods/SYSTEM/Table/init.lua b/mods/SYSTEM/Table/init.lua index dd0292c..b5a5ad5 100644 --- a/mods/SYSTEM/Table/init.lua +++ b/mods/SYSTEM/Table/init.lua @@ -408,3 +408,17 @@ function table.key_value_list(t, separator) return result end + +---Finds and removes from the list all elements matching the value. +---@generic value any +---@param list value[] +---@param value value +---@param value[] +function table.remove_value(list, value) + local index = table.indexof(list, value) + while index ~= -1 do + list = table.remove(list, index) + end + + return list +end