Add table.trim

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

View file

@ -83,4 +83,13 @@ function table.concat(table1, table2)
table.insert(result, v) table.insert(result, v)
end end
return result return result
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 end