Comparison

util/stanza.lua @ 11574:21217f7e82b9

util.stanza: add at_top helper This allows the user to detect whether the cursor is currently at the top of the stanza. This will be used by util.xmppstream to be able to port it over.
author Jonas Schäfer <jonas@wielicki.name>
date Sat, 08 May 2021 16:31:48 +0200
parent 11264:2cdcf55c6dd5
child 11639:ad39528e647d
comparison
equal deleted inserted replaced
11573:cb5748f94840 11574:21217f7e82b9
134 local last_add = self.last_add; 134 local last_add = self.last_add;
135 if last_add then t_remove(last_add); end 135 if last_add then t_remove(last_add); end
136 return self; 136 return self;
137 end 137 end
138 138
139 function stanza_mt:at_top()
140 return self.last_add == nil or #self.last_add == 0
141 end
142
139 function stanza_mt:reset() 143 function stanza_mt:reset()
140 self.last_add = nil; 144 self.last_add = nil;
141 return self; 145 return self;
142 end 146 end
143 147