Module:DecToHex

From Computing Classics Wiki
Revision as of 12:09, 3 March 2021 by TheDragonFire123 (talk | contribs) (Hex converter module)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:DecToHex/doc

-- Convert given decimals to lowercase hex.
local p = {}

function p.decToHex(decToConvert)
	hex = ""
	hex = hex .. string.format("%x", decToConvert)
	
	if (decToConvert < 16) then
		hex = "0" .. hex
	end
	
	return hex
end

return p
Cookies help us deliver our services. By using our services, you agree to our use of cookies.