Template:Callback/doc
This is a documentation subpage for Template:Callback.
It contains usage information, categories and other content that is not part of the original template page.
This template is used to document callbacks. It should only be used to document callbacks that are part of the ROBLOX API and should never be used to document functions, methods, or anything that isn't a callback.
Usage
<onlyinclude>{{Callback |name='''name''' |description='''description''' [|parameters='''parameters'''] [|returns='''returns'''] [|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.
Options
- name
- The name of the callback.
- parameters
- The values passed to the callback. See the section on parameters for more info on parameters.
- returns
- The types of the values that the callback function should return. 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 callback does not return anything.
- description
- A description of the callback.
- object
- The name of the object the callback belongs to, if there is only one. Otherwise, use the objects option.
- objects
- Links to the objects the callback belongs to, if there are more than one. Otherwise, use the object option.
Parameters
Parameters are formatted similarly to arguments in the Method Template. They 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 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 preferable, 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.
Callbacks
Callbacks are not exactly the same thing as methods, even though they share a similar icon. If you look closely at their icon and compare it to the icon of methods, you will notice some differences. Callbacks are used in the following way:
Object.Callback = function (param1)
return val1
end
In the code above, Object is an object, Callback is the name of a callback belonging to the object, and function is a function that will be set as the callback. param1 is the parameter passed to the function when it is called, and val1 is the value the function should return.
Notes
- If you need to put things after the callback, make sure to use the {{Clear floats}} template between the method and the rest of the page.
- All callbacks should be categorized under the Callbacks category.