Mercurial Hosting > luan
diff src/luan/modules/Io.luan @ 1308:70eecde81820
remove fn,... to improve readability
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 23 Jan 2019 23:37:02 -0700 |
parents | 8432d20a2729 |
children | f41919741100 |
line wrap: on
line diff
--- a/src/luan/modules/Io.luan Wed Jan 23 13:34:18 2019 -0700 +++ b/src/luan/modules/Io.luan Wed Jan 23 23:37:02 2019 -0700 @@ -61,25 +61,25 @@ end -function Io.output_to(out,fn,...) +function Io.output_to(out,fn) local old_out = Io.stdout - return try( { - function(...) + return try { + function() Io.stdout = out - return fn(...) - end; + return fn() + end finally = function() Io.stdout = old_out - end; - }, ... ) + end + } end local uri = Io.uri -- make local -function Io.output_of(fn,...) +function Io.output_of(fn) local string_uri = uri "string:" local out = string_uri.text_writer() - Io.output_to(out,fn,...) + Io.output_to(out,fn) out.close() return string_uri.read_text() end