Add table.trim
This commit is contained in:
parent
cd9886bb34
commit
0390af3d42
1 changed files with 9 additions and 0 deletions
|
@ -84,3 +84,12 @@ function table.concat(table1, table2)
|
||||||
end
|
end
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Trims nil values from a table.
|
||||||
|
--- @param target table The table to trim
|
||||||
|
--- @return table The trimmed table
|
||||||
|
function table.trim(target)
|
||||||
|
return table.filter(target, function(v)
|
||||||
|
return v ~= nil
|
||||||
|
end)
|
||||||
|
end
|
Loading…
Add table
Reference in a new issue