aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSolderpunk <solderpunk@sdf.org>2018-12-08 15:03:00 +0000
committerSolderpunk <solderpunk@sdf.org>2018-12-08 15:03:00 +0000
commitef7199eda199834f0cccd273715d9397584d5942 (patch)
treedc7200386f9aa8685c69a51cdfc0897351dbc7df
parentDon'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-xtelem.lua18
1 files 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