Module:Expcurve

local p = {}

function p.exp( curve, level ) return math.ceil(curve * (level-1)^2 / 9604) end

function p._table( args ) local root = mw.html.create( 'table' ) local curve = args[1]

local headers = root :attr('class', 'wikitable') :css('text-align', 'center') :tag('tr')

for i = 1, 3 do   headers :tag('th'):css('width', '75px'):wikitext('Level'):done :tag('th'):css('width', '75px'):wikitext('Accumulated Exp'):done :tag('th'):css('width', '75px'):wikitext('To Next Level'):done end

for i = 1, 33 do    local line = root:tag('tr') for j = 0,66,33 do     line :tag('th'):wikitext(i + j):done :tag('td'):wikitext(p.exp(curve, i + j)):done local exptonextlevelcell = line:tag('td') if i + j == 99 then exptonextlevelcell:wikitext('--') else exptonextlevelcell:wikitext(p.exp(curve, i + j + 1) - p.exp(curve, i + j)) end end -- for j end -- for i

return tostring(root) end

function p.table(frame) -- If called via #invoke, use the args passed into the invoking template, or the args passed to #invoke if any exist. -- Otherwise assume args are being passed directly in from the debug console or from another Lua module. local origArgs if frame == mw.getCurrentFrame then origArgs = frame:getParent.args for k, v in pairs(frame.args) do			origArgs = frame.args break end else origArgs = { frame } end return p._table(origArgs) end return p