From 47b056861b95ffc81614cf78f4b98c8cfb83a18b Mon Sep 17 00:00:00 2001 From: Tigran Aivazian Date: Mon, 24 Sep 2012 20:38:18 +0100 Subject: [PATCH] Slightly shorter and more Lua-idiomatic way of reading lines. --- fileinfo.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fileinfo.lua b/fileinfo.lua index 7894a0d62..d030c1cf9 100644 --- a/fileinfo.lua +++ b/fileinfo.lua @@ -62,9 +62,7 @@ function FileInfo:getFolderContent() InfoMessage:show("Scanning folder...", 1) local tmp = assert(io.popen('du -a \"'..self.pathfile..'\"', "r")) local dirs, files, books, size, name, output, ftype, j = -1, 0, 0, 0 - while true do - output = tmp:read("*line") - if not output then break end + for output in tmp:lines() do j = output:find("/") name = output:sub(j, -1) size = tonumber(output:sub(1, j-1)) -- in kB