Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can someone explain why you should use metatables?

Asked by 5 years ago

I understand what they do to a certain extent. But I don't see any reason to use them. Can someone tell me anything you would have to use them for?

0
Onion... NIMI5Q -2 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

I use metatables to do object-oriented programming. Basically, I just use them to store information. Here is a tutorial: https://devforum.roblox.com/t/all-about-object-oriented-programming/8585

Currently, I've created a 'Sword' object for a game I am creating; using OOP allows me to quickly create a variety of swords because all swords inherit the 'Sword' object, or class, but obviously have different damages and abilities. For example, a Darkheart is a sword, but it isn't the same as a LinkedSword.

I'm sure metatables have other neat uses, but this has been my favorite so far.

Ad

Answer this question