utils.tohex

Convert a string into hex

Prototype

s = utils.tohex (s)

Description

This converts the string s to hexadecimal (printable) form. The string may contain binary zeroes. Use string.lower to make a lower-case version if that is what you prefer.

eg.

print (utils.tohex ("Nick Gammon")) --> 4E69636B2047616D6D6F6E

Lua functions

Topics