aboutsummaryrefslogtreecommitdiffstats
path: root/util/serialization.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2015-08-20 13:05:22 +0200
committerKim Alvefur <zash@zash.se>2015-08-20 13:05:22 +0200
commit80c7d5155e9c468d86f3b268e90303decd7d1827 (patch)
tree103fd7d9396b60b9f76071a009c54d3ca9d35744 /util/serialization.lua
parentf1313996a2db339fe76f269353cc911c68316f30 (diff)
parentc5e4af96d8bd9de7a96d3dc1eff5b8d1eecbfdaf (diff)
downloadprosody-80c7d5155e9c468d86f3b268e90303decd7d1827.tar.gz
prosody-80c7d5155e9c468d86f3b268e90303decd7d1827.zip
Merge 0.10->trunk
Diffstat (limited to 'util/serialization.lua')
-rw-r--r--util/serialization.lua14
1 files changed, 9 insertions, 5 deletions
diff --git a/util/serialization.lua b/util/serialization.lua
index 04901135..206f5fbb 100644
--- a/util/serialization.lua
+++ b/util/serialization.lua
@@ -20,7 +20,7 @@ local debug_traceback = debug.traceback;
local log = require "util.logger".init("serialization");
local envload = require"util.envload".envload;
-module "serialization"
+local _ENV = nil;
local indent = function(i)
return string_rep("\t", i);
@@ -71,16 +71,16 @@ local function _simplesave(o, ind, t, func)
end
end
-function append(t, o)
+local function append(t, o)
_simplesave(o, 1, t, t.write or t_insert);
return t;
end
-function serialize(o)
+local function serialize(o)
return t_concat(append({}, o));
end
-function deserialize(str)
+local function deserialize(str)
if type(str) ~= "string" then return nil; end
str = "return "..str;
local f, err = envload(str, "@data", {});
@@ -90,4 +90,8 @@ function deserialize(str)
return ret;
end
-return _M;
+return {
+ append = append;
+ serialize = serialize;
+ deserialize = deserialize;
+};