aboutsummaryrefslogtreecommitdiffstats
path: root/util/stanza.lua
diff options
context:
space:
mode:
Diffstat (limited to 'util/stanza.lua')
-rw-r--r--util/stanza.lua41
1 files changed, 21 insertions, 20 deletions
diff --git a/util/stanza.lua b/util/stanza.lua
index 35d600ed..b63fc411 100644
--- a/util/stanza.lua
+++ b/util/stanza.lua
@@ -177,11 +177,11 @@ end
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 @@ function deserialize(stanza)
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)