diff options
author | Solderpunk <solderpunk@sdf.org> | 2018-12-08 15:03:00 +0000 |
---|---|---|
committer | Solderpunk <solderpunk@sdf.org> | 2018-12-08 15:03:00 +0000 |
commit | ef7199eda199834f0cccd273715d9397584d5942 (patch) | |
tree | dc7200386f9aa8685c69a51cdfc0897351dbc7df | |
parent | Don't duplicate boards when updating list. (diff) |
Swap usage of vars 'boards' and 'board_names' to match the uses in their declaration.
Diffstat (limited to '')
-rwxr-xr-x | telem.lua | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -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 |