Jump to content

Module:User:Mr. Stradivarius/sandbox

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Mr. Stradivarius (talk | contribs) at 12:23, 22 October 2014 (test error level numbers). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
local p = {}

function p.theError(n)
	if n == -1 then
		error('this has no explicit level')
	elseif n == 0 then
		error('this is level 0', 0)
	elseif n == 1 then
		error('this is explicit level 1', 1)
	elseif n == 2 then
		error('this is level 2', 2)
	else
		error('this is level 3', 3)
	end
end

function p._main(n)
	return p.theError(tonumber(n))
end

function p.main(frame)
	local args = require('Module:Arguments').getArgs(frame)
	return p._main(args[1])
end

return p