Add table.trim

This commit is contained in:
Simon Brodtmann 2025-02-28 09:39:21 +01:00
parent cd9886bb34
commit 0390af3d42

View file

@ -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