aboutsummaryrefslogtreecommitdiff
path: root/telem.lua
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xtelem.lua20
1 files changed, 18 insertions, 2 deletions
diff --git a/telem.lua b/telem.lua
index cba014b..8127e48 100755
--- a/telem.lua
+++ b/telem.lua
@@ -1,5 +1,5 @@
#!/usr/bin/env lua
-telemver = "0.3 // 2018-05-04"
+telemver = "0.4 // 2019-04-27"
require("pl.strict")
file = require("pl.file")
@@ -44,6 +44,7 @@ current_thread = {} -- Active thread table, always an element of current_board_
current_thread_posts = {} -- Array of post tables, containing posts associated with current_thread
current_post_index = nil -- Integer index into current_thread_posts
colours = true -- Boolean, controls whether to use ANSI colours
+reversemessages = false -- Boolean, controls message sort order
-- Setuid stuff
@@ -147,7 +148,11 @@ function get_threads(board)
table.insert(threads, thread)
::continue::
end
- table.sort(threads, function(x,y) return x.updated > y.updated end)
+ if reversemessages then
+ table.sort(threads, function(x,y) return x.updated < y.updated end)
+ else
+ table.sort(threads, function(x,y) return x.updated > y.updated end)
+ end
return threads
end
@@ -247,6 +252,16 @@ function do_colour()
end
end
+function do_setmessageorder()
+ if reversemessages then
+ reversemessages = false
+ print("Newest messages displayed at top.")
+ else
+ reversemessages = true
+ print("Newest messages displayed at bottom.")
+ end
+end
+
function do_go()
io.write("Go to which board? (use name or index) ")
local board = string.upper(io.read())
@@ -624,6 +639,7 @@ dispatch["?"] = do_help2
dispatch["!"] = do_rules
dispatch["w"] = do_who
dispatch["s"] = do_scan
+dispatch["S"] = do_setmessageorder
dispatch["="] = do_unimplemented
dispatch["M"] = do_unimplemented
dispatch["n"] = do_new