# HG changeset patch # User Kim Alvefur # Date 1616532727 -3600 # Node ID c0c4431ab27be9d65b590f6b2bc5da29b9dd46fe # Parent c90ef87457797ce6fe7ad94c2a5b1c6476573b57 mod_admin_shell: Sort timers by time in debug:timers() Easier to see which timers are happening soon vs further in the future if they are in some sensible order. diff -r c90ef8745779 -r c0c4431ab27b plugins/mod_admin_shell.lua --- a/plugins/mod_admin_shell.lua Tue Mar 23 21:46:11 2021 +0100 +++ b/plugins/mod_admin_shell.lua Tue Mar 23 21:52:07 2021 +0100 @@ -1307,6 +1307,7 @@ normalize_time = server.timer.to_absolute_time or normalize_time; end if h then + local timers = {}; for i, id in ipairs(h.ids) do local t, cb = h.priorities[i], h.items[id]; if not params then @@ -1319,7 +1320,11 @@ elseif params[id] then cb = params[id].callback or cb; end - print(format_time(t), cb); + table.insert(timers, { format_time(t), cb }); + end + table.sort(timers, function (a, b) return a[1] < b[1] end); + for _, t in ipairs(timers) do + print(t[1], t[2]) end end if server.event_base then