Changeset

9865:37278b420c74

util.serialization: Use util.hex
author Kim Alvefur <zash@zash.se>
date Sun, 17 Mar 2019 21:25:33 +0100
parents 9864:9d80e679c371
children 9866:09cc8c856e5e
files util/serialization.lua
diffstat 1 files changed, 2 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/util/serialization.lua	Sun Mar 17 21:16:27 2019 +0100
+++ b/util/serialization.lua	Sun Mar 17 21:25:33 2019 +0100
@@ -16,6 +16,8 @@
 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 @@
 	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