Comparison

util/stanza.lua @ 1874:262ea889016f

util.stanza: Add __type to metatable
author Matthew Wild <mwild1@gmail.com>
date Sun, 04 Oct 2009 14:03:08 +0100
parent 1523:841d61be198f
child 1931:f203330eb82e
comparison
equal deleted inserted replaced
1873:3b770710a1ee 1874:262ea889016f
32 32
33 local log = require "util.logger".init("stanza"); 33 local log = require "util.logger".init("stanza");
34 34
35 module "stanza" 35 module "stanza"
36 36
37 stanza_mt = {}; 37 stanza_mt = { __type = "stanza" };
38 stanza_mt.__index = stanza_mt; 38 stanza_mt.__index = stanza_mt;
39 39
40 function stanza(name, attr) 40 function stanza(name, attr)
41 local stanza = { name = name, attr = attr or {}, tags = {}, last_add = {}}; 41 local stanza = { name = name, attr = attr or {}, tags = {}, last_add = {}};
42 return setmetatable(stanza, stanza_mt); 42 return setmetatable(stanza, stanza_mt);