|
| 24 Dec 2015 06:48 PM |
| I've read up on metatables and can't see a single decent use for them, but I've been told they're actually very valuable, so I assume I'm wrong. What would they be used for? |
|
|
| Report Abuse |
|
|
UFAIL2
|
  |
| Joined: 14 Aug 2010 |
| Total Posts: 6905 |
|
|
| 24 Dec 2015 06:49 PM |
| It all depends on what you want to use them for. The major use case is for objects. In Roblox they serve less of a purpose because all of the objects you need are made. If for example, a Vector3 class did not exist, you'd be making it from scratch via metatables. |
|
|
| Report Abuse |
|
|
nox7
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 27467 |
|
|
| 24 Dec 2015 06:58 PM |
I personally do not agree they are a productive choice for anything you may do in ROBLOX.
The most popular choice is wrappers, but wrappers cause efficiency to go down heavily. Don't use them for high-end production. Just stick to what Lua is meant for. Functions. Quick and fast execution. |
|
|
| Report Abuse |
|
|
|
| 24 Dec 2015 07:00 PM |
Aren't metatables like no-longer working anymore? I've read in DingDong272's tutorials correct me if I'm wrong. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 24 Dec 2015 07:30 PM |
There are some really cool and clever uses when it comes to metatables on Roblox. Anyways, behind the scenes metatables are used everywhere. When you call: part:Destroy() for example. Each instance does not have its own Destroy function (that would be a waste of memory) rather, it inherits from Instance. So all derived types from Instances share the same Destroy function. It makes it easier to manage and saves memory.
And then ofc. it goes on and on, pretty much everything you do Roblox-specific uses OOP in some way. |
|
|
| Report Abuse |
|
|