Skip to content

Instantly share code, notes, and snippets.

@yi
Created July 24, 2014 18:52
Show Gist options
  • Save yi/01e3ab762838d567e65d to your computer and use it in GitHub Desktop.
Save yi/01e3ab762838d567e65d to your computer and use it in GitHub Desktop.
lua hex <= => string
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
@yi
Copy link
Author

yi commented May 12, 2020

is that a separate file to my lua file ? how can i attach that code please explain to me thanks

simple copy this piece code into your code

Copy link

ghost commented Jul 4, 2020

very nice !

@kissoflove
Copy link

good job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment