Software /
code /
prosody
Changeset
1517:22be7637a64d
util.stanza: Convert spaces to tabs
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 10 Jul 2009 02:25:14 +0100 |
parents | 1516:4c9bd0527d1d |
children | 1518:9707dfa80980 |
files | util/stanza.lua |
diffstat | 1 files changed, 21 insertions(+), 20 deletions(-) [+] |
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)