aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSolderpunk <solderpunk@sdf.org>2018-12-08 16:00:08 +0000
committerSolderpunk <solderpunk@sdf.org>2018-12-08 16:00:08 +0000
commit24079f744f425a16c0d03b418f2b5121293abb99 (patch)
tree0a0dc9d200a50950d6f1dde45a20240964d58c85
parentGracefully handle empty lines. (diff)
Shorten 'cat_file' function using Penlight's file.read.
-rwxr-xr-xtelem.lua5
1 files changed, 1 insertions, 4 deletions
diff --git a/telem.lua b/telem.lua
index b73c275..91916fd 100755
--- a/telem.lua
+++ b/telem.lua
@@ -26,10 +26,7 @@ current_post_index = nil -- Integer index into current_thread_posts
-- Utility functions
function cat_file(filename)
- io.input(filename)
- contents = io.read("*all")
- io.input(io.stdin)
- io.write(contents)
+ io.write(file.read(filename))
end
function getchar()