Last active
March 11, 2024 22:00
-
-
Save uriid1/c4792927a1f73ade4a54a87e3c8bc087 to your computer and use it in GitHub Desktop.
Hex encode/decode
This file contains 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
--[[ | |
####--------------------------------#### | |
#--# Author: by uriid1 #--# | |
#--# License: GNU GPLv3 #--# | |
####--------------------------------#### | |
--]] | |
local M = {} | |
function M.decToHex(decimal) | |
local hexString = string.format("%X", decimal) | |
return hexString | |
end | |
function M.hexToDec(hex) | |
local decimal = tonumber(tostring(hex), 16) | |
return decimal | |
end | |
return M |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment