Skip to content

Commit

Permalink
Don't use vararg as optional arg in pretty.dump
Browse files Browse the repository at this point in the history
Use a named argument instead. Fix documentation formatting.
  • Loading branch information
mpeterv committed Jul 23, 2016
1 parent 6de19b7 commit caf2165
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lua/pl/pretty.lua
Expand Up @@ -266,16 +266,16 @@ function pretty.write (tbl,space,not_clever)
return concat(lines,#space > 0 and '\n' or '')
end

--- Dump a Lua table out to a file or stdout.
-- @param t {table} The table to write to a file or stdout.
-- @param ... {string} (optional) File name to write too. Defaults to writing
-- to stdout.
function pretty.dump (t,...)
if select('#',...)==0 then
--- Dump a Lua table out to a file or stdout.
-- @tab t The table to write to a file or stdout.
-- @string[opt] filename File name to write too. Defaults to writing
-- to stdout.
function pretty.dump (t, filename)
if not filename then
print(pretty.write(t))
return true
else
return utils.writefile(...,pretty.write(t))
return utils.writefile(filename, pretty.write(t))
end
end

Expand Down

0 comments on commit caf2165

Please sign in to comment.