OOP in Roblox #4 - Metatables in Module Scripts
Ойындар
In the fourth video of Object Oriented Programming in Roblox, I talk about how to implement metatables into module scripts. This allows you to use the functionality of metatables between scripts using module scripts. This strategy makes your code more understandable and expandable.
Make sure to Like and Subscribe!
If you have any questions comment below!
Пікірлер: 37
You're not getting enough recognition man! You're helping me a ton!
@BRicey
4 жыл бұрын
Thanks! I gotta grind really hard for the first few hundred subscribers... After that I think it should be easier. Thank you for telling me that I'm doing it right!
This series has really helped broaden my understanding with metatables and better code optimization. awesome!
@BRicey
2 жыл бұрын
Great to hear!
@kjanahan3776
11 ай бұрын
@@BRicey as soon as you mentioned abstraction you literally caused me to open my third eye
Good tutorials! I was finally able to get that "click" moment. Metatables had me confused, and I couldn't find people that show the details that I want to know, but you went over it!
Watching the entire series for the 100th time and now I finally understand object oriented programming.
My dreams of becoming professional scripter has come true :D Continue making script videos!
Amazing youtuber no questions asked
great video man!
@BRicey
4 жыл бұрын
Appreciate it!
Thank u so much dude
I don't really get any of this, why do we need 2 module scripts, why are we doing that? What is the metatable for? I'm very confused about this entire thing...
thanks so much for your series. I have a question is that is there any way to create a class which is inherited from 2 parents. Let's say I create class Vehicle then I create a Car class inheriting from Vehicle class. lastly, I create Mercedes class inheriting from Car. But I got nil value if I try to read Vehicle's properties from Mercedes class?? Please help me out if you have free time. Thanks a lot
@BRicey
2 жыл бұрын
Since lua is such a flexible language, you can do that, but I would highly discourage it. What you suggest is called multiple inheritance, and it can lead to all sorts of problems.
@conghoannguyen9927
2 жыл бұрын
@@BRicey Thank you so much for your answer. I got some issues about it and you're right. The best way is using Composition. It would be easy to manage..^^
Hope you make a new game series using OOP and compositions, like fighting game, or maze game, smh like that
@BRicey
2 жыл бұрын
I'm thinking about doing a maze game with rojo vscode, and OOP when I Have time
@nasrallahal-shaer8397
2 жыл бұрын
@@BRicey Wow that would be very entertaining, hope you can do it soon before my 2nd year starts 😁❤
Im confused can you make a video on its perks? My code can be messy sometimes
@BRicey
3 жыл бұрын
The Next Video of the OOP series talks about the pros and cons.
oh, i have a quick question. let's say i were to change the "base.Number" to something more advanced like base.Monsters = { ["Goblin"] = { DMG = 5; HP = 7; }; }; let's say I were to index a monster that doesn't exist, but how would I create a default that would just return the goblin, instead?
@22bunnies34
2 жыл бұрын
.__index is called when the index doesn't exist so do: metatable.__index = function() return base.Monsters["Goblin"] end)
@KevKevDawg
4 ай бұрын
@@22bunnies34i dont get where to out that
Quick question, what "episode" will we make our first tool, or first button or something like that?
It is almost sad that this vid has only 102 likes right now.............
Hey could you make a tutorial on how to save tables with DataStore2
@BRicey
4 жыл бұрын
Ya I already do: kzread.info/dash/bejne/l4F_u9Odg9nVfdY.html
@user-du6sc8vl1t
4 жыл бұрын
@@BRicey thanks ill check it out!
Is object oriented programming necessary to make good efficient functioning code?
@BRicey
4 жыл бұрын
No, it is not. You can use whatever programming style you want! I personally prefer OOP over anything else as it is the standard for game design and although complicated at first (especially in lua), it is VERY powerful and clean to use. That is a great question!
@user-du6sc8vl1t
4 жыл бұрын
@@BRicey Thanks, Im trying to learn OOP since like most advanced scripters use it, also your tutorials are really helping me understand!
@BRicey
4 жыл бұрын
@@user-du6sc8vl1t No problem, I'm glad you watch them.
Just use simple terms. My brain hurts 10 seconds into your videos lol
I thought surely OOP would be easier in roblox than python, but ig not lol.
@BRicey
2 жыл бұрын
Its way harder and more inconvienent since Lua is based on prototypes, not classes
gay