Diff

util/stanza.lua @ 964:3296db2ad4a0

util.stanza: stanza:reset() method to reset building state
author Matthew Wild <mwild1@gmail.com>
date Wed, 08 Apr 2009 20:12:40 +0100
parent 896:2c0b9e3c11c3
child 1151:8096941b6734
line wrap: on
line diff
--- a/util/stanza.lua	Wed Apr 08 20:01:53 2009 +0100
+++ b/util/stanza.lua	Wed Apr 08 20:12:40 2009 +0100
@@ -65,6 +65,14 @@
 	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);