Template:Method

From Legacy Roblox Wiki
Jump to navigationJump to search
[[{{{name}}} (Method)|{{{name}}}]]( {{{arguments}}} )
Returns {{{returns}}}
Description: {{{description}}}
Member of:
[purge] Template documentation

Documentation subpage icon

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