Help:Lua
Note: When you edit this page, you agree to release your contribution under the CC0. See Public Domain Help Pages for more info. |
Lua is a common scripting language used at web sites and in software to make additional functionality and adaptations. The Scribunto extension makes Lua available for Mediawiki powered sites, but can also be extended to other languages.
Background
[edit]Lua is provided in the wikitext by call to the parser function {{invoke:}}
, which takes two mandatory arguments.
The first is the page title in the module namespace, and the second is the method.
In addition, there might be arguments to the method, but the method can also traverse the frames to fetch its arguments.
The frames are available as special structures, and will be provided as the first argument to the method.
There are two different access models for the libraries.
Some are set up as part of a core mw
-structure, and some must be required
.
It is not always obvious how a specific library is defined, and how it is accessed.
Libraries
[edit]The core libraries provided by Scribunto are described in the Lua reference manual .
There are other extensions that provide Lua libraries, and some are of special interest because they are in use at Wikimedia-sites:
- Extension:ArticlePlaceholder – uses Lua to create content for missing articles.
- Extension:JsonConfig – provides an undocumented
mw.ext.data.get()
method. - Extension:ParserFunctions – provides an undocumented
mw.ext.ParserFunctions.expr()
method. - Extension:TitleBlacklist – provides a weakly documented
mw.ext.TitleBlacklist.test()
. Documentation at Extension:TitleBlacklist . - Extension:Wikibase Client – uses Lua to access defined entities. Documentation at Extension:Wikibase Client/Lua .
Other extensions can be found in Category:ScribuntoExternalLibraries extensions and Category:ScribuntoExternalLibraryPaths extensions .