Template:Callback/doc: Difference between revisions
>JulienDethurens Created page with "This template is used to document callbacks. It should only be used to document callbacks that are part of the ROBLOX API and should <strong>never</strong> be used to document..." |
>JulienDethurens *facepalm* |
||
Line 3: | Line 3: | ||
== Usage == | == Usage == | ||
<pre> | <pre><nowiki> | ||
<onlyinclude>{{Callback | <onlyinclude>{{Callback | ||
|name='''name''' | |name='''name''' | ||
Line 11: | Line 11: | ||
[|objects='''objects'''] | [|objects='''objects'''] | ||
}}</onlyinclude> | }}</onlyinclude> | ||
</pre> | </nowiki></pre> | ||
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. | 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. |
Revision as of 19:29, 9 April 2012
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''' [|arguments='''arguments'''] [|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 callback.
- arguments
- The arguments given by the callback. See the section on arguments for more info on arguments.
- 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 parameter.
- objects
- Links to the objects the callback 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 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.
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
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 called when the callback is called.
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.