![]() | This is an information page. It is not an encyclopedic article, nor one of Wikipedia's policies or guidelines; rather, its purpose is to explain certain aspects of Wikipedia's norms, customs, technicalities, or practices. It may reflect differing levels of consensus and vetting. |
![]() | This page in a nutshell: Scribbling involves converting templates to use Lua scripts for improved performance and maintainability by having thhe template invoke Lua-based modules. This enables efficient handling of logic and reduces the reliance on complex parser functions. For example, {{#invoke:Name1|Name2}} invokes the Lua script at Module:Name1. To get started, refer to Module:Example. Try the module by using Template:Basic scribbling example in your sandbox. |
This is a guide to Scribbling, also known as Luafication. Scribbling is an informal term used to describe the process of creating a new template or converting an existing one so that it invokes a module containing functions written in Lua script. The Scribunto[a] extension enables the embedding of scripting languages in MediaWiki. Currently, Lua is the only supported scripting language. This guide provides an overview of Scribbling and points to additional resources for further learning.
Scribbled templates consist of two components: The template itself, and one or more back-end modules, stored in the Module:
namespace. These modules contain Lua programs that are executed on the wiki servers to generate the wikitext that the template expands to.
Templates invoke a function within a module using the {{#invoke:}}
parser function.
The main purpose and primary advantage of Scribbling is improved template processing performance, as Lua scripts are significantly more efficient than traditional template parser functions. Another benefit is simplified code. By using Lua, Scribbling eliminates the need for complex parser function programming, such as {{#if}}
, {{#ifeq}}
, {{#switch}}
and {{#expr}}
, which were originally designed as extensions to a template system rather than a true programming language.[b] By handling complex logic within the module, Scribbling reduces clutter in the template itself, making it easier to maintain and update. Additionally, Scribbling addresses the issue of expansion depth limits by eliminating the need for templates to transclude other templates.[c]
Cite error: There are <ref group=lower-alpha>
tags or {{efn}}
templates on this page, but the references will not show without a {{reflist|group=lower-alpha}}
template or {{notelist}}
template (see the help page).