|
| 21 Aug 2016 04:47 PM |
Is there a real reason for something like this:
local a={} function a:r() --stuff end
|
|
|
| Report Abuse |
|
|
| |
|
|
| 21 Aug 2016 04:48 PM |
OOP. When you do that the function has an implied first parameter called 'self' that holds a reference (or the value in the case of non-objects) to whatever it was called on:
a:r(z) is the same as: a.r(self, z)
|
|
|
| Report Abuse |
|
|
|
| 21 Aug 2016 04:50 PM |
I don't really understand what that means. would the function only be manipulating the table or could it be named like that and still do other stuff
|
|
|
| Report Abuse |
|
|
| |
|
|
| 21 Aug 2016 04:57 PM |
Yeah. So when you call a method, the 'self' is actually the object it was called on:
part:Destroy() is virtually the same as: part.Destroy(part) |
|
|
| Report Abuse |
|
|