Changeset

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
parents 8644:3b28c7728e3f
children 8646:a267dfa9d81d
files util/stanza.lua
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
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;