This wiki is archived and useful information is being migrated to the main bzflag.org website

Difference between revisions of "Template:Apicall/doc"

From BZFlagWiki
Jump to: navigation, search
Line 6: Line 6:
  
 
<pre>{{apicall
 
<pre>{{apicall
| name            = bz_testApiCall()
+
| name            = bz_testApiCall
 
| nopagelink      =
 
| nopagelink      =
 
}}</pre>
 
}}</pre>
Line 14: Line 14:
  
 
{{apicall
 
{{apicall
| name            = bz_testApiCall()
+
| name            = bz_testApiCall
 
| nopagelink      =
 
| nopagelink      =
 
}}
 
}}
Line 20: Line 20:
  
 
<pre>{{apicall
 
<pre>{{apicall
| name            = bz_testApiCall()
+
| name            = bz_testApiCall
 
| description      = This is the description for the function. This particular function doesn't really do anything. The text of this function's description is intentionally long, so that you can see that, when it line-wraps, the text is still indented.
 
| description      = This is the description for the function. This particular function doesn't really do anything. The text of this function's description is intentionally long, so that you can see that, when it line-wraps, the text is still indented.
 
| nopagelink      =
 
| nopagelink      =
Line 29: Line 29:
  
 
{{apicall
 
{{apicall
| name            = bz_testApiCall()
+
| name            = bz_testApiCall
 
| description      = This is the description for the function. This particular function doesn't really do anything. The text of this function's description is intentionally long, so that you can see that, when it line-wraps, the text is still indented.
 
| description      = This is the description for the function. This particular function doesn't really do anything. The text of this function's description is intentionally long, so that you can see that, when it line-wraps, the text is still indented.
 
| nopagelink      =
 
| nopagelink      =
Line 36: Line 36:
  
 
<pre>{{apicall
 
<pre>{{apicall
| name            = bz_testApiCall(int theFirstParameter, int theSecondParameter)
+
| name            = bz_testApiCall
 
| description      = This function does nothing, except that it accepts two numbers as inputs.
 
| description      = This function does nothing, except that it accepts two numbers as inputs.
 
| param1          = theFirstParameter
 
| param1          = theFirstParameter
Line 51: Line 51:
  
 
{{apicall
 
{{apicall
| name            = bz_testApiCall(int theFirstParameter, int theSecondParameter)
+
| name            = bz_testApiCall
 
| description      = This function does nothing, except that it accepts two numbers as inputs.
 
| description      = This function does nothing, except that it accepts two numbers as inputs.
 
| param1          = theFirstParameter
 
| param1          = theFirstParameter
Line 64: Line 64:
  
 
<pre>{{apicall
 
<pre>{{apicall
| name            = int bz_testApiCall(int theFirstParameter, int theSecondParameter)
+
| name            = bz_testApiCall
 
| description      = This function does nothing, except that it accepts two numbers as inputs.
 
| description      = This function does nothing, except that it accepts two numbers as inputs.
 
| param1          = theFirstParameter
 
| param1          = theFirstParameter
Line 79: Line 79:
  
 
{{apicall
 
{{apicall
| name            = int bz_testApiCall(int theFirstParameter, int theSecondParameter)
+
| name            = bz_testApiCall
 
| description      = This function does nothing, except that it accepts two numbers as inputs.
 
| description      = This function does nothing, except that it accepts two numbers as inputs.
 
| param1          = theFirstParameter
 
| param1          = theFirstParameter

Revision as of 03:41, 15 December 2008

This template can be used for bzfs api call documentation pages. It contains fields for the parameters of the api call, it's return type (if any), a description for it, and some other api calls that can be referenced. The template supports up to 10 api call parameters, although support for more can be added by editing this template.

The template also includes a link at the bottom to the list of api functions, unless the parameter nopagelink is present (with any value). For simplicity, nopagelink has been set on all of the templates in this document, except for the last one.

To use the template, you must include at least a name parameter, and preferably a description. For example, a call that takes no arguments and returns nothing, and that doesn't have a desctiption, could be declared like this:

{{apicall
| name             = bz_testApiCall
| nopagelink       =
}}

This would result in the following:


void bz_testApiCall ()


No description


If we wanted a description for our call, we could do something like this:

{{apicall
| name             = bz_testApiCall
| description      = This is the description for the function. This particular function doesn't really do anything. The text of this function's description is intentionally long, so that you can see that, when it line-wraps, the text is still indented.
| nopagelink       =
}}

This would result in the following:


void bz_testApiCall ()


This is the description for the function. This particular function doesn't really do anything. The text of this function's description is intentionally long, so that you can see that, when it line-wraps, the text is still indented.


Now let's say that our function takes some parameters. We can add those like this:

{{apicall
| name             = bz_testApiCall
| description      = This function does nothing, except that it accepts two numbers as inputs.
| param1           = theFirstParameter
| param1type       = int
| param1desc       = This number is the first number. It doesn't do anything.
| param2           = theSecondParameter
| param2type       = int
| param2desc       = This is the second of the two numbers. Like the first number, this one does absolutely nothing.
| nopagelink       =
}}

This would result in the following:


void bz_testApiCall (int theFirstParameter, int theSecondParameter)


This function does nothing, except that it accepts two numbers as inputs.

Parameters:
theFirstParameter  -  This number is the first number. It doesn't do anything.
theSecondParameter  -  This is the second of the two numbers. Like the first number, this one does absolutely nothing.

We can also add documentation on the function's return value. This can be done like this:

{{apicall
| name             = bz_testApiCall
| description      = This function does nothing, except that it accepts two numbers as inputs.
| param1           = theFirstParameter
| param1type       = int
| param1desc       = This number is the first number. It doesn't do anything.
| param2           = theSecondParameter
| param2type       = int
| param2desc       = This is the second of the two numbers. Like the first number, this one does absolutely nothing.
| returns          = A number that means absolutely nothing. It might be 0, or it might be 1, or it might be something else.
}}

Which results in this:


{{{returntype}}} bz_testApiCall (int theFirstParameter, int theSecondParameter)


This function does nothing, except that it accepts two numbers as inputs.

Parameters:
theFirstParameter  -  This number is the first number. It doesn't do anything.
theSecondParameter  -  This is the second of the two numbers. Like the first number, this one does absolutely nothing.
Returns:
A number that means absolutely nothing. It might be 0, or it might be 1, or it might be something else.