Add table.trim
This commit is contained in:
parent
cd9886bb34
commit
0390af3d42
1 changed files with 9 additions and 0 deletions
|
@ -83,4 +83,13 @@ function table.concat(table1, table2)
|
|||
table.insert(result, v)
|
||||
end
|
||||
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
|
Loading…
Add table
Reference in a new issue