diff options
-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 |