clix.archive: Fix pagination message, rsm.first is a table

Tue, 09 Jul 2013 14:27:02 +0200

author
Kim Alvefur <zash@zash.se>
date
Tue, 09 Jul 2013 14:27:02 +0200
changeset 116
3ee83c4801b4
parent 115
1aaf30b457a0
child 117
c6b5d2039f25

clix.archive: Fix pagination message, rsm.first is a table

clix/archive.lua file | annotate | diff | comparison | revisions
--- a/clix/archive.lua	Mon Jul 08 13:15:07 2013 +0200
+++ b/clix/archive.lua	Tue Jul 09 14:27:02 2013 +0200
@@ -56,7 +56,13 @@
 					conn:query_archive(opts.to, opts, handle_results);
 					return
 				else
-					conn:info("Next page: --%s=%s", reverse and "before" or "after", result[reverse and "first" or "last"]);
+					local whatnext, nextpage = reverse and "before" or "after";
+					if reverse then
+						nextpage = result.first and result.first[1];
+					else
+						nextpage = result.last;
+				end
+					conn:info("Next page: --%s=%s", whatnext, nextpage);
 				end
 			end
 			conn:close();

mercurial