Comparison

util/template.lua @ 3640:4bc88bb748d1

util.template: Don't add stanza.last_add. 20% faster.
author Waqas Hussain <waqas20@gmail.com>
date Fri, 26 Nov 2010 05:26:12 +0500
parent 3637:bd491def3efb
child 4495:c0f5c78cb817
comparison
equal deleted inserted replaced
3639:889ef938552c 3640:4bc88bb748d1
76 end 76 end
77 return str..'}'; 77 return str..'}';
78 end 78 end
79 local function create_clone_string(stanza, lookup, xmlns) 79 local function create_clone_string(stanza, lookup, xmlns)
80 if not lookup[stanza] then 80 if not lookup[stanza] then
81 local s = ('setmetatable({name=%q,attr=%s,last_add={},tags={'):format(stanza.name, create_attr_string(stanza.attr, xmlns)); 81 local s = ('setmetatable({name=%q,attr=%s,tags={'):format(stanza.name, create_attr_string(stanza.attr, xmlns));
82 -- add tags 82 -- add tags
83 for i,tag in ipairs(stanza.tags) do 83 for i,tag in ipairs(stanza.tags) do
84 s = s..create_clone_string(tag, lookup, stanza.attr.xmlns)..";"; 84 s = s..create_clone_string(tag, lookup, stanza.attr.xmlns)..";";
85 end 85 end
86 s = s..'};'; 86 s = s..'};';