Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
lua fromhex and tohex function
function string.fromhex(str)
return (str:gsub('..', function (cc)
return string.char(tonumber(cc, 16))
end))
end
function string.tohex(str)
return (str:gsub('.', function (c)
return string.format('%02X', string.byte(c))
end))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment