Module:Sandbox/User:Artoire

Revision as of 10:23, 29 November 2024 by Artoire (talk | contribs) (Created page with "local data = require('Module:Experience/data') local last_seen = 0 for i = 0, 500 do if data.album[i] ~= nil then if data.album[i] <= last_seen then error(('Level %s is not strictly greater than the previous value (%s <= %s)'):format(i, data.album[i], last_seen)) end last_seen = data.album[i] end end local output = mw.html.create('table') :addClass('wikitable sortable') :tag('tr') :tag('th'):wikitext('L'):done() :tag('th'):wikitext('XP'):done() :tag(...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:Sandbox/User:Artoire/doc

local data = require('Module:Experience/data')

local last_seen = 0
for i = 0, 500 do
	if data.album[i] ~= nil then
		if data.album[i] <= last_seen then
			error(('Level %s is not strictly greater than the previous value (%s <= %s)'):format(i, data.album[i], last_seen))
		end
		last_seen = data.album[i]
	end
end

local output = mw.html.create('table')
	:addClass('wikitable sortable')
	:tag('tr')
		:tag('th'):wikitext('L'):done()
		:tag('th'):wikitext('XP'):done()
		:tag('th'):wikitext('Album'):done()
		:tag('th'):wikitext('Ratio'):done()
	:done()

for i = 0, 499 do
	if data.album[i] ~= nil then
		local needed = data.level[i+1]-data.level[i]
		output:tag('tr')
			:tag('td'):wikitext(i):done()
			:tag('td'):wikitext(needed):done()
			:tag('td'):wikitext(data.album[i]):done()
			:tag('td'):wikitext(needed / data.album[i]):done()
		:done()
	end
end

return { main = function() return output end }