Table: add table.remove_value method

This commit is contained in:
Van
2026-05-09 22:57:45 +03:00
parent 5265024231
commit 2b7600b745

View File

@@ -408,3 +408,17 @@ function table.key_value_list(t, separator)
return result return result
end 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