author | Kim Alvefur <zash@zash.se> |
Wed, 03 Sep 2014 00:37:41 +0200 | |
changeset 6384 | 3f4809d01783 |
parent 6375 | 76d8907d5301 |
child 6548 | ec566d7cd518 |
permissions | -rw-r--r-- |
local s_char = string.char; local function char_to_hex(c) return ("%02x"):format(c:byte()) end local function hex_to_char(h) return s_char(tonumber(h, 16)); end local function to(s) return s:gsub(".", char_to_hex); end local function from(s) return s:gsub("..", hex_to_char); end return { to = to, from = from }