Module:Math/Dec2Hex: Difference between revisions

From ALttPR Wiki
Jump to navigation Jump to search
(Created page with "local p = {} function dec2hex(decnum) return string.format("%X", decnum) end function p._convert(n) return dec2hex(n) end function p.convert(frame) -- Allow for invoc...")
 
(No difference)

Latest revision as of 17:25, 27 March 2020

local p = {}

function dec2hex(decnum)

 return string.format("%X", decnum)

end

function p._convert(n)

 return dec2hex(n)

end

function p.convert(frame)

 -- Allow for invocation via #invoke or directly from another module
 local args
 if frame == mw.getCurrentFrame() then
   args = frame.args
 else
   args = frame
 end
 local n = tonumber(args[1])
 return p._convert(n)

end

return p