#what are metatables?
1 messages · Page 1 of 1 (latest)
** You are now Level 5! **
Tables but with meta as a prefix
netatables are basically methods that u can use for tables search up in documation for the methods you can use.
so all it does is find a table?
it takes in a table and then you set that table to a method and thats how you can use it
a method of what
metatables are tables that contain special functions of which run when certain events occur
So if you attach the metatable to another table, actions on that table will run whats in the metatable
metatables are attachable tables of metamethods
hope this helps 🙏
next question forum is gonna be what is metamethods
ggs
what are metamethods :)) sorry im new to all of this
pre-fired it
From the docs:
Metamethods are the functions that are stored inside a metatable. They can go from calling a table, to adding a table, to even dividing tables as well. Here's the list of available metamethods:
metamethods are the members of metatables
hope this hgelps…..
💔
pretty sure this all goes into the methods of a module
. and : i think so
i forgot
its 5 am
😂 ✌️
the only real difference between these two is : automatically has a self in it
oh guys i have a commision for admin commands so how do you get access to the chat like if you said !kick in chat it'd kick the player
this is how you would usually see it meaning that if you use self these would show up as an option
looks like your a pro scripter 😉
player.Chatted
or something
idk
oh i did not now that
when did u start learning
and my stupid ahh cant even understand this
i dont really know a way to explain this other than its basically a table but complicated
oh yea i should've waited till i was smarter to learn scripting 😭
metatable is a table on a table
fr
you dont really need to like be smarter to learn scripting
basically when you perform certain actions on a table it checks for a metatable on the table and for the metamethod
you just have to understand it
and actually know when to use it
from my experience
so if you try to use division symbol on a table itd check for the __div metamethod
That’s inheritance, no?
well i started learning since 2022 and my stupid ahh cant make a button simulator or calculate a rebirth button multiplier
idk brodie im sleepy as fuck i can barely read my fuck ass scripts
All good
so your weaknesses are just math
You want to know how to use metatables?
Or how to know them
yes pleasee anything
Well a good example is a fantasy game with many playable characters like knights, healer etc..
oh so for like a fighting game
The knight and healer are both characters
mhmm
So you create a class named character , and you apply common traits like health, speed , etc..
ohhhhh i seee
After that you specify things depending on your needs, for example you want your knight to have more health then the healer, so you create another class (sub-class) named knight, then you inherit the characteristics of the character class (like health) and you override it with what you want
The only thing you need to do is understand the syntaxe and you’ll be good
yea im not really good at that either
It can differ depending on programming languages, but the core concept stays the same
HI guys, anyone here familiar with text filtering ?
this doesn’t have anything to do with metatables just so U know…… lol
You can look it up on the wiki
Classes are derived from metatables
(theyre not )
they arent
I explained the concept used in programming languages
** You are now Level 3! **
The concept is, but it can differ depending on programming languages but it uses OOP too
Well that’s how I learned them
i suppose you learned incorrectly, then..:
And to specify he wanted to know how to use them
That’s why I gave a specific example that probably don’t align with its real functionality
what
…
He wanted an example so I gave him a simple one
the example you gave doesn’t have anything to do with metatables
Metatables are used to implant OOP
I could’ve gone into details, but he wanted a simple example for its use
the example you gave doesn’t have anything to do with metatables
Metatables are used to implement OOP, I gave a basic example on it, so yeah it does have to do something with metatables
tell me where a metatable was used in the example you provided
Buddy I said I didn’t go into the details, I gave a general example of its use
You can make classes with metatables
you can indeed, which is not what you did
In the example I said that
what you said previously, that "metatables are classes" is simply not true.
you should probably look over OOP fundementals and what exactly a class means again
Yeah derived from metatables
No need
you can create classes without metatables.
the reason we use metatables in luau is to avoid allocating storage to duplicate methods
which do not exist in the example you provided, since it's a basic table of class stats
Good luck making inheritance and shared methods
I mainly use metatables for that feature
I feel as though you're just ignoring everything I'm saying, so im just gonna go overdose on cocaine
Not really the example I gave was about inheritance too
Thats a use for metatables too
You said that the example didn’t provide duplicated methods
your example contains no methods, and thus, has no need for a metatable - a table of metamethods
Bro
Like I said I didn’t go over the details I just gave a general use for metatables
Such has using them to implement OOP
Bro wanted me to explain metamethods before giving an example of its use
what
Explaining why metatables are used before explaining how
you explained neither, as I've said many times before
your example contained no methods, and thus, had no need for a metatable
I gave an example why it’s used ; to do OOP classes , methods, inheritance , etc..
** You are now Level 4! **
But indirectly
you told him how to store statistics for different characters such as damage, hp and speed
Yeah attributes
Attributes are not OOP?

simply using objects, or features of objects, does not automatically make your code "OOP"
more likely you weren't paying attention in class
Dont worry
Attributes are a fundamental concept in OOP
correct
And an F in practice
I guess attributes are not a part of OOP now
Notice how I didn't say anything about your argument
This guy is just not a master debater
Im not the best at English
Henceforth, simply just respond in lua. I will understand you
** You are now Level 5! **
HelloWorld(print)
;compile
;compile
@bright pebble ok I'm gonna ask you two questions ok
Your two responses are "yes" and "no", you can only use each response a single time
Does that sound good
@bright pebble
Go ahead
Are you gay
Hmm
Remember only yes or no
No
Are you lying?
No
What kind rule is that 
You agreed to it before I asked
Remember
that's true
Dang