Changeset

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
parents 963:43b140edfd84
children 965:8bc06338aac3
files util/stanza.lua
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
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);