Comparison

util/stanza.lua @ 4136:19f2830fbe02

util.stanza: Make some globals local, so they don't clutter the global checking script's output. It's also a minor optimization ;)
author Waqas Hussain <waqas20@gmail.com>
date Thu, 03 Feb 2011 13:13:49 +0500
parent 4132:ccc16434dbe2
child 4146:a361c578c1f2
child 4168:4919831b5b56
comparison
equal deleted inserted replaced
4135:9dfb3c0101b5 4136:19f2830fbe02
42 42
43 module "stanza" 43 module "stanza"
44 44
45 stanza_mt = { __type = "stanza" }; 45 stanza_mt = { __type = "stanza" };
46 stanza_mt.__index = stanza_mt; 46 stanza_mt.__index = stanza_mt;
47 local stanza_mt = stanza_mt;
47 48
48 function stanza(name, attr) 49 function stanza(name, attr)
49 local stanza = { name = name, attr = attr or {}, tags = {} }; 50 local stanza = { name = name, attr = attr or {}, tags = {} };
50 return setmetatable(stanza, stanza_mt); 51 return setmetatable(stanza, stanza_mt);
51 end 52 end
53 local stanza = stanza;
52 54
53 function stanza_mt:query(xmlns) 55 function stanza_mt:query(xmlns)
54 return self:tag("query", { xmlns = xmlns }); 56 return self:tag("query", { xmlns = xmlns });
55 end 57 end
56 58