Help:Lua debugging: Difference between revisions

Content deleted Content added
fix portals, brackets, typos, dates, links, references, categories, formatting and persondata, typos fixed: milions → millions, wikipedia → Wikipedia using AWB
Line 29:
 
== Using personal sandbox for script development ==
The English wikipediaWikipedia has the [[mw:Extension:TemplateSandbox|Template Sandbox]] extension installed. There is a synergy between the "template sandbox" and "Scribunto" extensions, which allows to develop and modify Lua modules in private (i.e., in the user space) pages, before moving them to the global space.
=== Using "Template Sandbox" to develop Lua modules ===
Let's take a practical example. for this example, assume your user name is "Lua Developer". Let's say you want to test a bug-fix or enhancement to the [[Module:String|String]] module. There are two reasons you can't do it directly: this module contains functions that are used by hundreds of templates, transcluded in milionsmillions of articles. Any bug will present a huge disruption to Wikipedia. The 2nd reason is more prosaic: because this module is so central, it is also protected, and our "Lua Developer" user does not have the required permissions to modify this module.
 
So, the first step in "sandboxing" is to copy [[Module:String]] to the private page [[User:Lua Developer/sandbox/Module:String]]. Now our developer can edit the module to her heart's content. At any given moment, she can open [[Special:TemplateSandbox]], using the default "Sandbox prefix", which in her case, will be "User:Lua Developer/sandbox". This means that viewing any page from the sandbox page, whenever the parser encounters a Template '''T''' or Module '''M''', it will look first to see if a page named "User:Lua Developer/sandbox/Template:T" or "User:Lua Developer/sandbox/Module/M" exists, and if so, the parser will use those for the parsed page, instead of the ones in the "real" Module and Template namespaces. Any template or module which do not exist under the "Sandbox prefix", will be pulled by the parser from the appropriate namespace.