Software /
code /
prosody
Diff
util/stanza.lua @ 1517:22be7637a64d
util.stanza: Convert spaces to tabs
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 10 Jul 2009 02:25:14 +0100 |
parent | 1431:9fe9ba693f4a |
child | 1523:841d61be198f |
line wrap: on
line diff
--- a/util/stanza.lua Fri Jul 10 02:19:51 2009 +0100 +++ b/util/stanza.lua Fri Jul 10 02:25:14 2009 +0100 @@ -177,11 +177,11 @@ do - local id = 0; - function new_id() - id = id + 1; - return "lx"..id; - end + local id = 0; + function new_id() + id = id + 1; + return "lx"..id; + end end function preserialize(stanza) @@ -226,21 +226,22 @@ end function clone(stanza) - local lookup_table = {}; - local function _copy(object) - if type(object) ~= "table" then - return object; - elseif lookup_table[object] then - return lookup_table[object]; - end - local new_table = {}; - lookup_table[object] = new_table; - for index, value in pairs(object) do - new_table[_copy(index)] = _copy(value); - end - return setmetatable(new_table, getmetatable(object)); - end - return _copy(stanza) + local lookup_table = {}; + local function _copy(object) + if type(object) ~= "table" then + return object; + elseif lookup_table[object] then + return lookup_table[object]; + end + local new_table = {}; + lookup_table[object] = new_table; + for index, value in pairs(object) do + new_table[_copy(index)] = _copy(value); + end + return setmetatable(new_table, getmetatable(object)); + end + + return _copy(stanza) end function message(attr, body)