Module:Calculator/Level: Difference between revisions
From Melvor Idle
(First version) |
m (Replace Shared module with Number module) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
local MEXP = require('Module:Experience') | local MEXP = require('Module:Experience') | ||
local formatnum = require('Module:Number').formatnum | |||
function p.main(frame) | function p.main(frame) | ||
return p._main(frame) | |||
end | end | ||
Line 15: | Line 17: | ||
local expToN = MEXP.expForLevel(nextLevel) - exp | local expToN = MEXP.expForLevel(nextLevel) - exp | ||
return string.format("Experience for level %d: % | return string.format("Experience for level %d: %s. Experience for next level: %s", skillLevel, | ||
formatnum(exp), | |||
formatnum(expToN)) | |||
end | end | ||
return p | return p |
Latest revision as of 22:16, 12 March 2024
Documentation for this module may be created at Module:Calculator/Level/doc
local p = {}
local MEXP = require('Module:Experience')
local formatnum = require('Module:Number').formatnum
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: %s. Experience for next level: %s", skillLevel,
formatnum(exp),
formatnum(expToN))
end
return p