Jump to content

Module:Sandbox/Galobtter

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Galobtter (talk | contribs) at 16:28, 31 March 2018 (try). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local p = {}
function main(frame)
	args = require('Module:Arguments').getArgs()
	start = args.start
	last = args.last
	local text = args['logic']
	text = string.gsub(text, '{%-', '{{')
	text = string.gsub(text, '%-}', '}}')
	text = string.gsub(text, '!', '|')
	for i = start, last do
		n = 1
		local datanum = tostring(i)
		local strings = string.gmatch(text, '(%a+)%$')
		local finaltext = string.gsub(text, '%a+%$', '{{{'..strings()..tostring(n)..'|}}}')
		args['data'..datanum] = mw.getCurrentFrame():getParent():preprocess(finaltext)
		n = n + 1
	end
end
return p