diff options
author | Kim Alvefur <zash@zash.se> | 2015-02-21 10:36:37 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2015-02-21 10:36:37 +0100 |
commit | 3015aac8bcb38ed2d00b8f5205bd54d82b96e71a (patch) | |
tree | f7609b77dfead0a8d6994597c5799196676080bd /util/serialization.lua | |
parent | 2b0b78b8b0210906d14f52f70fffefac2a744dba (diff) | |
download | prosody-3015aac8bcb38ed2d00b8f5205bd54d82b96e71a.tar.gz prosody-3015aac8bcb38ed2d00b8f5205bd54d82b96e71a.zip |
util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Diffstat (limited to 'util/serialization.lua')
-rw-r--r-- | util/serialization.lua | 14 |
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; +}; |