diff options
author | Kim Alvefur <zash@zash.se> | 2019-03-17 21:25:33 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2019-03-17 21:25:33 +0100 |
commit | 8999b2a97c8d5e0d9dcf10d7692f928287d6bc5e (patch) | |
tree | 0b11cab6dc0e0bc9860c2ebed02a46bba2480ee6 /util/serialization.lua | |
parent | a335b6de27f7da7df46ec7a4091b6d1ea8ba2fba (diff) | |
download | prosody-8999b2a97c8d5e0d9dcf10d7692f928287d6bc5e.tar.gz prosody-8999b2a97c8d5e0d9dcf10d7692f928287d6bc5e.zip |
util.serialization: Use util.hex
Diffstat (limited to 'util/serialization.lua')
-rw-r--r-- | util/serialization.lua | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/util/serialization.lua b/util/serialization.lua index 2ead8c12..60e341cf 100644 --- a/util/serialization.lua +++ b/util/serialization.lua @@ -16,6 +16,8 @@ local s_char = string.char; local s_match = string.match; local t_concat = table.concat; +local to_hex = require "util.hex".to; + local pcall = pcall; local envload = require"util.envload".envload; @@ -24,15 +26,6 @@ local m_type = math.type or function (n) return n % 1 == 0 and n <= 9007199254740992 and n >= -9007199254740992 and "integer" or "float"; end; -local char_to_hex = {}; -for i = 0,255 do - char_to_hex[s_char(i)] = s_format("%02x", i); -end - -local function to_hex(s) - return (s_gsub(s, ".", char_to_hex)); -end - local function rawpairs(t) return next, t, nil; end |