aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-03-17 21:25:33 +0100
committerKim Alvefur <zash@zash.se>2019-03-17 21:25:33 +0100
commit34f85c79c0f3127ed03d10d8d94d1e9a152798ed (patch)
tree0b11cab6dc0e0bc9860c2ebed02a46bba2480ee6
parent94ceae0f0b8560fe26ec148cbb8d8237739efc3e (diff)
downloadprosody-34f85c79c0f3127ed03d10d8d94d1e9a152798ed.tar.gz
prosody-34f85c79c0f3127ed03d10d8d94d1e9a152798ed.zip
util.serialization: Use util.hex
-rw-r--r--util/serialization.lua11
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