Difference between revisions of "Template:Function"

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
m
imported>StDoodle
m
Line 1: Line 1:
 
<includeonly><p><b>{{#if: {{{aggregate|}}}|[[Aggregate|{{{return_type}}}]]|[[{{{return_type}}}]] }}{{#if: {{{return_also|}}}|&nbsp;/&nbsp;{{#if: {{{aggregate|}}}|[[Aggregate|{{{return_also}}}]]|[[{{{return_also}}}]] }} }}&nbsp;{{{name}}}(</b>{{#if: {{{parameter1|}}}|{{{parameter1}}} }}{{#if: {{{parameter2|}}}|{{{parameter2}}} }}{{#if: {{{parameter3|}}}|{{{parameter3}}} }}{{#if: {{{parameter4|}}}|{{{parameter4}}} }}{{#if: {{{parameter5|}}}|{{{parameter5}}} }}<b>)</b></p>{{#if: {{{p1desc|}}}|* {{{p1desc}}} }}{{#if: {{{p2desc|}}}|* {{{p2desc}}}}}{{#if: {{{p3desc|}}}|* {{{p3desc}}}}}{{#if: {{{p4desc|}}}|* {{{p4desc}}}}}{{#if: {{{p5desc|}}}|* {{{p5desc}}}}}
 
<includeonly><p><b>{{#if: {{{aggregate|}}}|[[Aggregate|{{{return_type}}}]]|[[{{{return_type}}}]] }}{{#if: {{{return_also|}}}|&nbsp;/&nbsp;{{#if: {{{aggregate|}}}|[[Aggregate|{{{return_also}}}]]|[[{{{return_also}}}]] }} }}&nbsp;{{{name}}}(</b>{{#if: {{{parameter1|}}}|{{{parameter1}}} }}{{#if: {{{parameter2|}}}|{{{parameter2}}} }}{{#if: {{{parameter3|}}}|{{{parameter3}}} }}{{#if: {{{parameter4|}}}|{{{parameter4}}} }}{{#if: {{{parameter5|}}}|{{{parameter5}}} }}<b>)</b></p>{{#if: {{{p1desc|}}}|* {{{p1desc}}} }}{{#if: {{{p2desc|}}}|* {{{p2desc}}}}}{{#if: {{{p3desc|}}}|* {{{p3desc}}}}}{{#if: {{{p4desc|}}}|* {{{p4desc}}}}}{{#if: {{{p5desc|}}}|* {{{p5desc}}}}}
 
</includeonly>
 
</includeonly>
<noinclude>This is the template to display a line of function information (for the function page template, see [[Template:FunctionPage]]). Supply the function ''name,'' the data type of the value it ''returns,'' and what, if any, ''parameters'' it takes.[[Category:Basic Templates]]
+
<noinclude>This is the template to display a line of function information (for the function page template, see [[Template:FunctionPage]]).
To call a function on a page, refer to this example:
+
==Using This Template==
 +
*"name" should be set to the name of the function, without parentheses (for link-building & displaying with parameters; parentheses will automatically be added by the template in the appropriate place).
 +
*"aggregate" should be listed and set to anything you'd like if the function returns an [[aggregate]] (map) data type. If this function returns a simple data type, delete this line.
 +
*"return_type" should be set to the datatype returned by the function.
 +
*"return_also" should be set to a secondary datatype. For instance, some functions can return both a [[string]] and a [[buffer]]. For most functions, which only return a single datatype, this line should be deleted.
 +
*"parameter1" through "parameter5" should be set to the parameters the function accepts. Each should be set using [[Template:Param]]. Use these parameters in order: don't start with "parameter2" if you don't include a "parameter1". (They can be listed in any order, if you really desire; you just can't skip an earlier parameter if you want them to display correctly.)
 +
**The first argument is the data type of the parameter
 +
**The second argument is the short description to display for the parameter (optional).
 +
**If the parameter is an aggregate, you should include "ag=yes" in the template call.
 +
**For more information, see [[Template:Param]].
 
<pre>
 
<pre>
 
{{Function|
 
{{Function|

Revision as of 14:09, 28 February 2010

This is the template to display a line of function information (for the function page template, see Template:FunctionPage).

Using This Template

  • "name" should be set to the name of the function, without parentheses (for link-building & displaying with parameters; parentheses will automatically be added by the template in the appropriate place).
  • "aggregate" should be listed and set to anything you'd like if the function returns an aggregate (map) data type. If this function returns a simple data type, delete this line.
  • "return_type" should be set to the datatype returned by the function.
  • "return_also" should be set to a secondary datatype. For instance, some functions can return both a string and a buffer. For most functions, which only return a single datatype, this line should be deleted.
  • "parameter1" through "parameter5" should be set to the parameters the function accepts. Each should be set using Template:Param. Use these parameters in order: don't start with "parameter2" if you don't include a "parameter1". (They can be listed in any order, if you really desire; you just can't skip an earlier parameter if you want them to display correctly.)
    • The first argument is the data type of the parameter
    • The second argument is the short description to display for the parameter (optional).
    • If the parameter is an aggregate, you should include "ag=yes" in the template call.
    • For more information, see Template:Param.
{{Function|
name=NAME_OF_FUNCTION|
aggregate=ANYTHING_IF_RETURNS_AGGREGATE_OR_DELETE|
return_type=DATATYPE_RETURNED_(IF_AGGREGATE_FULL_MAP_DEFINITION)|
return_also=SECONDARY_DATATYPE_RETURNED_OR_DELETE|
parameter1={{Param|DATATYPE|SHORT_DESC}}|
parameter2={{Param|DATATYPE|SHORT_DESC}}|
parameter3={{Param|DATATYPE|SHORT_DESC}}|
parameter4={{Param|DATATYPE|SHORT_DESC}}|
parameter5={{Param|DATATYPE|SHORT_DESC}}|
p1desc=LONG_DESCRIPTION_OF_PARAMETER|
p2desc=LONG_DESCRIPTION_OF_PARAMETER|
p3desc=LONG_DESCRIPTION_OF_PARAMETER|
p4desc=LONG_DESCRIPTION_OF_PARAMETER|
p5desc=LONG_DESCRIPTION_OF_PARAMETER}}