Changeset

4936:92c86e11fd44

util.stanza: Make stanza:childtags() behave like :get_child()
author Kim Alvefur <zash@zash.se>
date Thu, 05 Jul 2012 17:58:47 +0200
parents 4935:bc62abceef07
children 4937:b3fe52353295
files util/stanza.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/util/stanza.lua	Tue Jul 03 15:56:32 2012 +0200
+++ b/util/stanza.lua	Thu Jul 05 17:58:47 2012 +0200
@@ -133,14 +133,14 @@
 end
 
 function stanza_mt:childtags(name, xmlns)
-	xmlns = xmlns or self.attr.xmlns;
 	local tags = self.tags;
 	local start_i, max_i = 1, #tags;
 	return function ()
 		for i = start_i, max_i do
 			local v = tags[i];
 			if (not name or v.name == name)
-			and (not xmlns or xmlns == v.attr.xmlns) then
+			and ((not xmlns and self.attr.xmlns == v.attr.xmlns)
+				or v.attr.xmlns == xmlns) then
 				start_i = i+1;
 				return v;
 			end