From ef7199eda199834f0cccd273715d9397584d5942 Mon Sep 17 00:00:00 2001 From: Solderpunk Date: Sat, 8 Dec 2018 15:03:00 +0000 Subject: Swap usage of vars 'boards' and 'board_names' to match the uses in their declaration. --- telem.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/telem.lua b/telem.lua index 3aa6d30..bb68f7c 100755 --- a/telem.lua +++ b/telem.lua @@ -43,12 +43,12 @@ end function update_boards() for board in lfs.dir(path.join(_BBS_ROOT, "boards")) do - if string.sub(board, 1, 1) ~= "." and not boards[board] then - boards[board] = true - table.insert(board_names, board) + if string.sub(board, 1, 1) ~= "." and not board_names[board] then + board_names[board] = true + table.insert(boards, board) end end - table.sort(board_names) + table.sort(boards) end function get_threads(board) @@ -117,9 +117,9 @@ function do_board() local topic_file = path.join(board_dir, "topic") file.write(topic_file, desc) -- Update representation of BBS - boards[board] = true - table.insert(board_names, board) - table.sort(board_names) + board_names[board] = true + table.insert(boards, board) + table.sort(boards) -- Done! print("Board created.") end @@ -129,7 +129,7 @@ function do_go() local board = string.upper(io.read()) if board == "" then do_list() - elseif boards[board] == nil then + elseif board_names[board] == nil then print("No such board! Hit `l` to list boards.") else current_board = board @@ -147,7 +147,7 @@ end function do_list() update_boards() - for _,b in pairs(board_names) do + for _,b in ipairs(boards) do local threads = -3 -- Don't want to count "topic" file or "." or ".." for topic in lfs.dir(path.join(_BBS_ROOT, "boards", b)) do threads = threads +1 -- cgit v1.2.3