aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-04-08 20:12:40 +0100
committerMatthew Wild <mwild1@gmail.com>2009-04-08 20:12:40 +0100
commited0da8eb5621274bae8b33b75bc4ac07aca40f80 (patch)
treec20bf1be85285be023d834f17e45cef5d4788038
parent493839e2acc5b05bec6733c5a345ffff6ddd46d1 (diff)
downloadprosody-ed0da8eb5621274bae8b33b75bc4ac07aca40f80.tar.gz
prosody-ed0da8eb5621274bae8b33b75bc4ac07aca40f80.zip
util.stanza: stanza:reset() method to reset building state
-rw-r--r--util/stanza.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/util/stanza.lua b/util/stanza.lua
index 1ad3679b..7e40dfa4 100644
--- a/util/stanza.lua
+++ b/util/stanza.lua
@@ -65,6 +65,14 @@ function stanza_mt:up()
return self;
end
+function stanza_mt:reset()
+ local last_add = self.last_add;
+ for i = 1,#last_add do
+ last_add[i] = nil;
+ end
+ return self;
+end
+
function stanza_mt:add_direct_child(child)
if type(child) == "table" then
t_insert(self.tags, child);