Jump to content

User:Codemini/Lua Tutorial/Accessing parameters from wikitext

From Wikipedia, the free encyclopedia
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Accessing parameters

Functions called by {{#invoke:}} will be passed a single parameter, that being a frame object. To access the parameters passed to the {{#invoke:}} code will typically use the args table of that frame object. It's also possible to access the parameter passed to the template containing the {{#invoke:}} by using frame:getParent() and accessing that frame's args. The frame object is also used to access context-specific features of the wikitext parser, such as calling parser functions, expanding templates, and expanding arbitrary wikitext strings. Example:

  frame.args.text
-- which will passed to the {{#invoke:}} and accessed using {{#invoke:Example|text=}} anywhere on a non-module page

Previous Next