Method: Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>TaslemGuy Minor mistake in formatting was corrected. |
>TaslemGuy Minor mistake in formatting was corrected. |
(No difference)
|
Revision as of 14:27, 23 December 2010
Introduction
Methods are functions which belong to a particular object. Although standard Lua doesn't have them, they're a major focus of Roblox Lua. Methods act like a function stored within an object. The method itself is accessed in the same way a Function in a Table is accessed. However, a special property of methods changes how they are called.
These two codes call the same function (a) with the same parameters (b).
b.a(b) b:a()
The second is more brief and concise. Methods can increase typing speed, because there is less need to retype variable names. Methods may or may not return data.
Examples
All instances (possibly excluding) some core services, have the remove method, along with the clone method. Sounds have the Play method and the Stop method.