Scribunto: An Introduction/Glossary

From Wikibooks, open books for an open world
Jump to navigation Jump to search

This is a list of terms often used in this book.

Short form of "arguments".
The inputs to a function. For example, if I passed the argument "Fred" to a greeting function, it might return the result "Hello, Fred!" Arguments also refers to the input values that a Lua module receives from a wiki page. Such arguments are often stored in a table named args. Arguments are almost the same as parameters; the difference is that parameters are the possible inputs to a function, whereas arguments are what you actually put in.
A group of code statements that form a cohesive unit. Think "chunk of code". The code inside a function definition is a block, as is the code between then and end in an if-then-end construct.
The frame that is one step lower in the frame hierarchy than another given frame. For example, if a wiki page calls a template, which in turn calls a Lua module via #invoke, the frame created by #invoke is the child of the template's frame.
debug console
An console for interactively running Scribunto code. It can be found on the edit screen for Lua modules, underneath the edit window and the edit summary box, and is preloaded with the code you type into the edit window. Requires JavaScript.
Frame objects are the interface between wiki pages and Scribunto. They allow access to arguments passed to #invoke, and to the MediaWiki parser.
A block of code that can be reused in different places. Functions can have parameters, which allows them to produce different output for different inputs.
The #invoke parser function is used to run Lua modules from wiki pages. The result returned from the module is shown on the wiki page in place of the parser function code.
Keys are the indexes for Lua tables. Normally, to find a value in a table, you let Lua know which table you want, and specify which key Lua should check.
Software used to write other software. Using libraries to write software is usually a lot easier than writing equivalent software from scratch. Scribunto uses both standard Lua libraries and libraries written specifically for MediaWiki.
The programming language used by Scribunto. Lua was developed in 1993 at the Pontifical Catholic University of Rio de Janeiro, Brazil. It is fast, easily embeddable, and has a relatively simple syntax.
The wiki collaboration software used to power Wikipedia, the popular online encyclopaedia. Scribunto is an extension for the MediaWiki software.
A special kind of function that belongs to an object. Used in object-oriented programming.
The container for a Lua script. In MediaWiki, a module is a page in the Module namespace which contains Lua code. To run a Lua script you must specify both the module name and the function name.
MediaWiki's main way of organising different types of content. For example, on most MediaWiki installations, the main content is located in the main namespace, images and audio are located in the File namespace, and templates are located in the Template namespace. Namespaces are differentiated by their prefix; pages in the main namespace might have no prefix, pages in the File namespace might have a prefix of "File:", and pages in the template namespace might have a prefix of "Template:".
A programming construct which contains data and the functions used to act on that data. Functions belonging to an object are known as methods. Objects are the basic unit of object-oriented programming.
The possible inputs to a function. See arguments.
The frame that is one step higher in the frame hierarchy than another given frame. For example, if a wiki page calls a template, which in turn calls a Lua module via #invoke, the template's frame is the parent of the frame created by #invoke.
The part of the MediaWiki software that converts wikitext into HTML. Some of the steps that the parser takes to do this can be accessed from Scribunto. For example, it is possible to expand a MediaWiki template and use the resulting wikitext in a Lua module by using a frame object.
parser function
Wikitext that the parser treats as special, usually delineated by double curly braces {{ }}. #invoke is an example of a parser function. May also refer to the ParserFunctions extension, which provides conditional logic structures such as #if and #switch to MediaWiki templates.
A return value is the output of a function. If, for a given input, a function outputs the number 12, you would say the function "returns 12".
An extension to the MediaWiki software allowing scripts written in the Lua programming language to be embedded into wiki pages.
Lua's basic data structure. A table contains pairs of keys and values. You find a value by looking up a key in the table.
A type of MediaWiki page used to display similar or identical content on multiple pages. For example, on Wikipedia, templates are used to create navigational boxes and maintenance banners for encyclopaedia articles.
A type of web application that allows people to create and edit content collaboratively. Wikipedia is an example of a wiki.
The popular online encyclopaedia, powered by the MediaWiki software.
MediaWiki's markup language. An innovation made early in the history of MediaWiki, wikitext allowed users to quickly create structures such as HTML lists and HTML tables without having to learn HTML itself. However, nowadays it is seen as somewhat hard to learn for the average web user who is used to more visual interfaces for creating content. Scribunto modules must output wikitext, which is then transformed into HTML by the MediaWiki parser.