Created
April 25, 2013 10:27
-
-
Save cristobal/5458842 to your computer and use it in GitHub Desktop.
Port of php.js bin2hex to lua http://phpjs.org/functions/bin2hex/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function bin2hex (str) | |
| local val = "" | |
| for i = 1, str:len() do | |
| char = string.byte(str:sub(i, i)) | |
| val = string.format("%s%02X%s", val, char, "") | |
| end | |
| return val | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment