Module:Math/Hex2Dec

From ALttPR Wiki
Revision as of 17:21, 27 March 2020 by Matrethewey!9776 (talk | contribs) (Created page with "local p = {} function hex2dec(hexnum) return tonumber(hexnum, 10) end function p._convert(n) return hex2dec(n) end function p.convert(frame) -- Allow for invocation v...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

local p = {}

function hex2dec(hexnum)

 return tonumber(hexnum, 10)

end

function p._convert(n)

 return hex2dec(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