Module:Example/doc

From Meta, a Wikimedia project coordination wiki
Jump to navigation Jump to search

This is the documentation page for Module:Example

Examples[edit]

  • {{#invoke:example|hello}} → Hello World!
  • {{#invoke:example|hello_to|Fred}} → Hello, Fred!
  • {{#invoke:example|count_fruit|bananas=5|apples=12}} → I have 5 bananas and 12 apples
  • {{#invoke:example|test|3|abc=2|4}} → table - attempt to return the whole table of parameters at once; just gives the word 'table'
  • {{#invoke:example|get_parameters|3|abc=2|4}} → 3 4 7 2 14 - shows that no distinction has to be made between abc being a string variable and being a numerical variable: its value 2 can be used in a computation as well as in a concatenation. In wikitext this is similar, except that in Lua concatenation requires dot pairs, while wikitext requires triple braces around parameter names and parameter numbers, and a parser function for computations. Both allow, in different ways, the distinction between the value of the variable abcdef and the concatenation of the values of the variables abc and def.
  • {{#invoke:example|get_parameters1|3|abc=2|4}} → 3 4 7 2 14

See also[edit]