Comparison

util/stanza.lua @ 3475:0307a3ac3885

util.stanza: Optimisation, remove useless if...then in stanza:children() iterator
author Matthew Wild <mwild1@gmail.com>
date Sun, 29 Aug 2010 15:07:00 +0100
parent 3474:730876bbe4e6
child 3477:6350b114e0e4
comparison
equal deleted inserted replaced
3474:730876bbe4e6 3475:0307a3ac3885
120 120
121 function stanza_mt:children() 121 function stanza_mt:children()
122 local i = 0; 122 local i = 0;
123 return function (a) 123 return function (a)
124 i = i + 1 124 i = i + 1
125 local v = a[i] 125 return a[i];
126 if v then return v; end
127 end, self, i; 126 end, self, i;
128 end 127 end
129 128
130 function stanza_mt:matched_children(name, xmlns) 129 function stanza_mt:matched_children(name, xmlns)
131 xmlns = xmlns or self.attr.xmlns; 130 xmlns = xmlns or self.attr.xmlns;