Skip to content

Instantly share code, notes, and snippets.

@ttys3
Forked from yi/gist:01e3ab762838d567e65d
Created April 19, 2021 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ttys3/0a7c80c457f844eac6c2e75846bbb6da to your computer and use it in GitHub Desktop.
Save ttys3/0a7c80c457f844eac6c2e75846bbb6da to your computer and use it in GitHub Desktop.
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