Add table.filterKey
This commit is contained in:
parent
e4ad298324
commit
6ca6034186
1 changed files with 12 additions and 0 deletions
|
|
@ -70,6 +70,18 @@ function table.filter(target, predicate)
|
||||||
return result
|
return result
|
||||||
end
|
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.
|
--- Concatenates two tables into a new table.
|
||||||
--- @param table1 table The first table
|
--- @param table1 table The first table
|
||||||
--- @param table2 table The second table
|
--- @param table2 table The second table
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue