Skip to content

Instantly share code, notes, and snippets.

@Moligaloo
Created July 19, 2015 14:01
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 Moligaloo/775202cb5b5c13bbf128 to your computer and use it in GitHub Desktop.
Save Moligaloo/775202cb5b5c13bbf128 to your computer and use it in GitHub Desktop.
Convert lua function to hexadecimal string format and back
function func2hex(func)
return (string.dump(func):gsub(".", function(c) return ("%02X"):format(c:byte()) end));
end
function hex2func(hex)
return loadstring(hex:gsub("..", function(x) return string.char(tonumber(x, 16)) end))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment