Update _G.dump()

This modifies code of `_G.dump()` to make it more explicit with `nil` values. Now `dump(nil)` will print `nil` instead of not doing anything.
This also changes printing of multiple arguments: it will print on separate lines instead of separated with spaces.
This commit is contained in:
Evgeni Chasnovski 2021-08-21 11:31:53 +03:00 committed by Timothée Sterle
parent 13af62882a
commit f5672b5ded

View File

@ -408,9 +408,14 @@ Writing `print(vim.inspect(x))` every time you want to inspect the contents of a
```lua
function _G.dump(...)
local objects = vim.tbl_map(vim.inspect, {...})
print(unpack(objects))
return ...
local objects, v = {}, nil
for i = 1, select('#', ...) do
v = select(i, ...)
table.insert(objects, vim.inspect(v))
end
print(table.concat(objects, '\n'))
return ...
end
```