Method: Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>TaslemGuy
Minor mistake in formatting was corrected.
>Flurite
Redirected page to Methods
 
(12 intermediate revisions by 5 users not shown)
Line 1: Line 1:
==Introduction==
#redirect [[Methods]]
 
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).
 
<pre>b.a(b)
b:a()
</pre>
 
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.

Latest revision as of 20:28, 23 January 2012

Redirect to: