Module:Calculator/Level: Difference between revisions

From Melvor Idle
(First version)
 
m (Call main function)
Line 4: Line 4:


function p.main(frame)
function p.main(frame)
return p._main(frame)
end
end



Revision as of 21:02, 29 February 2024

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

local p = {}

local MEXP = require('Module:Experience')

function p.main(frame)
	return p._main(frame)
end

function p._main(frame)
	local args = frame:getParent().args
	
	local skillLevel = math.max(args.level, 1)
	local nextLevel = math.min(skillLevel + 1, 1999)
	
	local exp = MEXP.expForLevel(skillLevel)
	local expToN = MEXP.expForLevel(nextLevel) - exp
	
	return string.format("Experience for level %d: %d. Experience for next level: %d", skillLevel, exp, expToN)
end

return p