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.
pull/81/head
Evgeni Chasnovski 3 years ago committed by Timothée Sterle
parent 13af62882a
commit f5672b5ded

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

Loading…
Cancel
Save