Comparison

plugins/mod_pubsub/pubsub.lib.lua @ 9206:33ee40dc3e25

Pubsub: Add tests for :get_last_item() and fix for non-persistent nodes
author Matthew Wild <mwild1@gmail.com>
date Sat, 18 Aug 2018 15:10:41 +0100
parent 9200:249d90ff992e
child 9207:76d593b35958
comparison
equal deleted inserted replaced
9205:2e710b618440 9206:33ee40dc3e25
870 max_items = size; 870 max_items = size;
871 return archive:delete(user, { 871 return archive:delete(user, {
872 truncate = size; 872 truncate = size;
873 }); 873 });
874 end 874 end
875 function get_set:tail() 875 function get_set:head()
876 -- This should conveniently return the last item 876 -- This should conveniently return the most recent item
877 local item = self:get(nil); 877 local item = self:get(nil);
878 if item then 878 if item then
879 return item.attr.id, item; 879 return item.attr.id, item;
880 end 880 end
881 end 881 end