Module:StoreTableHead

From RuneScape Classic Wiki
Jump to: navigation, search

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

local p = {}

local params = require('Module:Paramtest')
local yesno = require('Module:Yesno')
local var = mw.ext.VariablesLua

function p.main(frame)
	local args = frame:getParent().args
	local buymultiplier,sellmultiplier,delta = params.defaults{
					{args.BuyMultiplier,1000},
					{args.SellMultiplier,1000},
					{args.Delta,10},
				}
				
	var.vardefine('BuyMultiplier', buymultiplier)
	var.vardefine('SellMultiplier', sellmultiplier)
	var.vardefine('Delta', delta)

	local ret = mw.html.create('tr')
	ret:tag('th'):attr('colspan', 2):wikitext('Item'):done()
		:tag('th'):wikitext('Number<br>in stock'):done()
		:tag('th'):wikitext('Price<br>sold at'):done()
		:tag('th'):wikitext('Price<br>bought at'):done()
    local i = 1
    while args['column' .. i] do
		ret:tag('th'):attr('data-sort-type', 'number'):wikitext(args['column' .. i]):done()
		i = i+1
	end
	ret:done()
	
	return '<table class="wikitable sortable" style="text-align:center" cellpadding="2" cellspacing="0">' .. tostring(ret)
end
	
return p