Template:Method: Difference between revisions
>ArceusInator Got tired of having to write ''Category:Methods'' on each method page |
>JulienDethurens Categorizing pages with errors so we can fix them easily! :D |
||
(56 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
<div style="float:left; | {{if|1={{{name<includeonly>|</includeonly>}}}|2={{if|1={{{description<includeonly>|</includeonly>}}}|2=<div style="float:left; max-width:600px; width: 50%; min-height:120px; overflow:auto"> | ||
{ | {{{!}} cellspacing="0" cellpadding="4" style="margin: 2px; display: block; {{border-radius|6px}}; background: {{color|magenta}}; font-size: 90%; text-align: left; border: 4px solid {{color|magenta|dark}};" | ||
{{!}}style="padding: 1;font-size:120%; font-weight:bold;" colspan="2"{{!}}[[File:{{if|{{{protected|}}}|Protected_}}Method Icon.png]] [[{{{name}}} (Method)|{{{name}}}]]( {{{arguments<includeonly>|</includeonly>}}} ) | |||
{{!}}-style="background: {{color|magenta|light}};" | |||
{{!}}style="width: 10%; border-top: solid 1px {{color|magenta|dark}}; border-right: solid 1px {{color|magenta|dark}}; font-weight:bold;"{{!}}Returns | |||
{{!}}style="border-top: solid 1px {{color|magenta|dark}};"{{!}}{{{returns<includeonly>|{{nil}}</includeonly>}}} | |||
{{!}}- | |||
{{!}}style="width: 10%; border-top: solid 1px {{color|magenta|dark}}; border-right: solid 1px {{color|magenta|dark}}; font-weight:bold;"{{!}}Description: | |||
{{!}}style="border-top: solid 1px {{color|magenta|dark}};"{{!}}{{{description}}} | |||
{{!}}-style="background: {{color|magenta|light}};" | |||
{{!}}style="width: 10%; border-top: solid 1px {{color|magenta|dark}}; border-right: solid 1px {{color|magenta|dark}}; font-weight:bold;"{{!}}Member of: | |||
{{!}}style="border-top: solid 1px {{color|magenta|dark}};"{{!}}{{if|{{{object|}}}|{{type|instance={{{object|}}}}}|{{if|{{{objects|}}}|{{{objects|}}}}}}} | |||
{{!}}}</div>|3=<p class="error">The description must be specified.</p>[[Category:Pages with template errors]]}}|3=<p class="error">The name must be specified.</p>[[Category:Pages with template errors]]}}<noinclude>{{documentation}}[[Category:Object Documentation Templates]]</noinclude> | |||
== | |||
< | |||
}} | |||
< | |||
{{ | |||
}} | |||
[[Category:Object Documentation Templates]] | |||
</noinclude> |
Latest revision as of 07:11, 10 April 2012
[[{{{name}}} (Method)|{{{name}}}]]( {{{arguments}}} ) | |
Returns | {{{returns}}} |
Description: | {{{description}}} |
Member of: |
This is a documentation subpage for Template:Method.
It contains usage information, categories and other content that is not part of the original template page.
This template is used to document methods. It should only be used to document methods that are part of the ROBLOX API and should never be used to document functions or anything that isn't a method.
Usage
<onlyinclude>{{Method |name=name |description=description [|arguments=arguments] [|returns=types] [|protected=bool] [|object=object] [|objects=objects] }}</onlyinclude>
Note: text between brackets ([ and ]) is optional, text in bold represents a certain value (something you must replace) and the rest represents things that must be present as-is.
Parameters
- name
- The name of the method.
- arguments
- The arguments received by the method. See the section on arguments for more info on arguments.
- returns
- The types of the values returned by the function. Do not give them a name, only give their type. If they can be confusing, explain them in the description. If this argument is not specified, it will be indicated that the method does not return anything.
- description
- A description of the method.
- protected
- If specified, the icon of the method will indicate that the method is protected.
- object
- The name of the object this method belongs to, if there is only one. Otherwise, use the objects argument.
- objects
- Links to the objects this method belongs to, if there are more than one. Otherwise, use the object argument.
Arguments
Arguments should be separated by commas. Their type should always be written before their name and should always be identical to the one written in the object browser, the only exception being if the error messages given by the method specify a more specific type. The type should either be in raw text, either be a link to the page of the type or either be displayed with the {{type}} template. The name should always either be contained in a <var> tag, which is preferrable, either be italicized with wiki markup.
Default values for arguments should be indicated outside of the <var> or outside of the italicization and be indicated the same way as they are in the object browser.
Notes
- The method should always be at the top of the page.
- If you need to put things after the method, make sure to use the {{clear floats}} template between the method and the rest of the page.
- All methods should be categorized under the Methods category.
Example
This is an example of an use of this template with the FindFirstChild method:
{{Method |name = FindFirstChild |arguments = {{Type|string}} <var>name</var>, {{Type|bool}} <var>recursive</var> = false |returns = {{Type|instance=Instance}} |description = Returns the first child of this Instance that matches the first argument <var>name</var>. The second argument <var>recursive</var> is an optional boolean (defaults to {{false}}) that will force the call to traverse down thru all of this Instance's descendants until it finds an object with a name that matches the <var>name</var> argument. The function will return {{nil}} if no Instance is found. |object = Instance }}
Here is the result it would produce:
FindFirstChild( string name, bool recursive = false ) | |
Returns | Instance |
Description: | Returns the first child of this Instance that matches the first argument name. The second argument recursive is an optional boolean (defaults to false) that will force the call to traverse down thru all of this Instance's descendants until it finds an object with a name that matches the name argument. The function will return nil if no Instance is found. |
Member of: | Instance |