You are browsing a read-only backup copy of Wikitech. The live site can be found at wikitech.wikimedia.org

Module:Sandbox

From Wikitech-static
Jump to navigation Jump to search

Scribunto testing area

This is not an actual Lua module. It exists to provide a convenient pseudo-namespace for code testing, hopefully preventing the main Module: namespace from becoming littered with experiments, as Lua modules cannot exist as subpages in the User: namespace.

Please name your experimental modules in the following format to help keep things tidy:

Module:Sandbox/Your User Name/Module name

<InputBox> type=create default=Sandbox/~~~/sometest preload=Module:Sandbox/new placeholder=Enter your experimental module name here prefix=Module: editintro=Template:New module editintro buttonlabel=Create new sandbox module </InputBox>

You can use Special:PrefixIndex/Module:Sandbox to list modules in this area.



local module = {}

function module.main(frame)
	local arg = frame.args
	local wikitext = arg['input'] or 'default'
	local div = mw.html.create('div')
	div
		:attr('id', 'testdiv')
		:css('width', '100%')
		:wikitext(mw.ustring.sub(wikitext, 5, 20))
	return tostring(div)
end


return module