From 34f85c79c0f3127ed03d10d8d94d1e9a152798ed Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 17 Mar 2019 21:25:33 +0100 Subject: util.serialization: Use util.hex --- util/serialization.lua | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'util') 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 -- cgit v1.2.3