Software /
code /
prosody
Diff
util/stanza.lua @ 8645:06c73b010488
util.stanza: Add :text_tag(), a shortcut for adding nodes with text
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 21 Mar 2018 23:20:26 +0100 |
parent | 8640:8f13ec2ceb06 |
child | 8889:c4e430c69f88 |
line wrap: on
line diff
--- a/util/stanza.lua Wed Mar 21 23:15:30 2018 +0100 +++ b/util/stanza.lua Wed Mar 21 23:20:26 2018 +0100 @@ -101,6 +101,10 @@ return self:tag("body", attr):text(text); end +function stanza_mt:text_tag(name, text, attr, namespaces) + return self:tag(name, attr, namespaces):text(text):up(); +end + function stanza_mt:tag(name, attr, namespaces) local s = new_stanza(name, attr, namespaces); local last_add = self.last_add;