Skip to content

Instantly share code, notes, and snippets.

@uriid1
Last active March 11, 2024 22:00
Show Gist options
  • Save uriid1/c4792927a1f73ade4a54a87e3c8bc087 to your computer and use it in GitHub Desktop.
Save uriid1/c4792927a1f73ade4a54a87e3c8bc087 to your computer and use it in GitHub Desktop.
Hex encode/decode
--[[
####--------------------------------####
#--# 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