What is Object Oriented Progamming?
MERCH ► shop.gnome.codes/
DISCORD ► / discord
TWITCH ► / gnomecode
TWITTER ► / gnomecoderblx
WEBSITE ► gnome.codes/
TIMESTAMPS ►
0:00 Why OOP?
2:21 Creating an object
4:50 Metatable
8:18 Metamethods
12:24 Conclusion
Пікірлер: 135
This completely described what metatable is for me cause I literally never used it before even though I’m an experienced scripter and it seems like it’ll help me later on ❤
@mysyvcic
10 ай бұрын
metatables are so complicated to the point i dont even care about them
@EarthItself
9 ай бұрын
@@mysyvcic they are REALLY useful in the right situations tho
@neut_ro
9 ай бұрын
@Magic_Blox same bro
@MeinDasIstGut
9 ай бұрын
I don't know why but i never had much of a issue with metatables. All i saw metamethods as was just some specific events which you can set a callback to
@ahmed-music-prod
8 ай бұрын
@@mysyvcic exactly like its just easier not even using them lmao
That's what it's all about! I just yesterday wanted to make a module with timers so I can easily start and stop them like Timer:Continue() and Timer:Pause() and at the same time have several of them with different speeds and time remaining, but I looked for tutorials about it but never figured it out... And today you made a video about it! Your videos are very helpful and so easy to understand! That I finally understood what this scary creature is - metatable! Thank you so much, GnomeCode, for being you!))))
This video was suuuuper helpful! I've been wondering so long why some things use a . or a : and if it was something I can use myself or if it was only for built in roblox functions. This will help so much because I have a need for possibly dozens to hundreds of similar objects with varied stats
Hey gnomeCode im watching you since maybe episode 5 of tower defense tutorial and you inspired to actually learn programming and now im learning c# and advanced blender stuff and i just want to say thank you because if not you i would stop at just making a free model obby and quit and probably forget about programming
thank you so much gnomecode, ive been trying to learn about oop for so long, and this finally put logic in my head
Showing 'workspace' with its methods and functions really gave me the spark of understanding OOP more.. thanks
I appreciate you breaking things down in the manner you do. You’re by far the best teacher when it comes to learning Lua’s programming language. I’ve learned other programming languages in college. So I appreciate your style.
I really think this kind of video is valuable. It would be great if you could also create videos about other concepts or skills that are useful while writing scripts or good to know
Yay an another vid, TYSM gnomecode for all things you make for us 👍
This video is really interesting and helpful, thanks GnomeCode.
Exactly what I was thinking of learning next!
The explanation of __index is really what helped me understand the actual flow of what’s happening where I couldn’t before, thanks a ton❤. Basically, the module is just a bunch of default values for a table
Love these videos. Thanks gnome code!
Very helpful video! Thanks for making it. Could you continue your doors series? I really enjoy watching it, I learn a lot from it. (I don't write it down)
Great beginner tutorials you are creating!
this is 100% the best channel for learning scripting. This helped me so much
Super useful! I need to use module scripts more often, I always forget how useful they are.
This really did help me on what metatables are!
I was literally saying “oop” right before you said it
Nice I’ve been wanting to learn metatables for a while!
Nice beginner tutorials you are creating!
This video is actually incredibly good
w vid bro this finally solved my confusion (especially metatables lol)
ok this was a video I actually needed
@mysyvcic
10 ай бұрын
same here
best tutorial i ever found❤❤
thank you, now i understand how metatables are working
Thx man! I know how to use self now since I get confused all the time
By far the best OOP video on roblox ever made. 💖
Yay ur back with another vid. Can you make a series on how to make a Murder Mystery game, or and updated version of keys that u did in teddy caus putting the key in the tools didnt work for me. It make u break 90k but idk tho
that was very helpful thank you
no way i see a gnome code video 8 minutes after its uploaded 🥳
Maybe completing the collection by also doing a tutorial on Functional Programming?
love ur vids 😂
Hey gnomecode, you really helped me with your videos but can you please make a video on Magnitude and some other things like enemies atacking your base but if they see you then they atack you
I am 2 seconds in the the video and already love it! It helped me cure my illness!
@GnomeCode
10 ай бұрын
Wonderful
We need a tower defense tutorial for skins lol but im pretty sure you are done with that series
Is there any way to overload constructors? For example; local fruit = Fruit.new(“Apple”, “a fruit!”) local fruit = Fruit.new(“a fruit!”) and the second option uses the name parameter (apple) from the index table instead of putting “a fruit” as the name parameter?
@AngelofSweden
3 ай бұрын
Not sure how that would work as Lua is not a typed language.
That's what I needed
Thanks!
So useful!
Great video
My brain just randomly clicked on how to make something in a FPS framework, I'm gonna have made 50 of those before i even publish a game
I know you already did a piggy series, but you should make one of those maze games like cheese escape
Santa tell me... Will you get in beeeed?
Okay. So here's what im getting or learn't. correct me if im wrong. MetaTables allow u to manipulate values without having to define a new table variable. It has a default that if u send another table of values will check the MainTable to see if anything is missing and assign it if needed. EG if ur default has the quantity value and u send over just the name itll assign the default quantity. The index thing connects the main table to check if something else is already in there? or is it what connects the defaulttable to the new one to see if there is any values needed. --Personal Test-- I send over a food table with a new value of HPR(hpregen) and the table didnt break but instead treated it like it was already apart of it which I THINK IS VERY HELPFUL FOR MANY THINGS!! (If im wrong i don't mind being corrected im trying to learn, if im offmark or missing information please inform me :D)
how to make a purchase prompt for catalog items and clothes appear when text button gui is clicked
Could you please make a breakdown for creating party system thank you
Idea:💡 Can you please make a video on how to script plugins?
wow, this might be what i need to buss
Hey man, It would be awesome if you made a tutorial but just dedicated to the .__index part. For me, that's the hardest part to grasp in this video.
Thank you
I want to see a hungry pig tutorial video!
this is nice, but i would probably do something different for the .new() function. when you accept a table as an input for the new function, lua doesn't know what it's expecting. you should rather accept the individual attributes in the new function instead of a table. for example, this is more how i would do the new function function Food.new(name, color, description, price, quantity) local newFood = setmetatable({}, Food) newFood.Name = name newFood.Color = color newFood.Description = description newFood.Price = price newFood.Quantity = quantity return newFood end this will let the lua compiler verify that you are passing in valid arguments instead of garbage. You could before do something like "Food.new({garbage = "this is garbage"})" and it wouldn't complain. Sure, it works, but it wastes memory and there is no point. additionally, it will tell people what arguments the function is expecting when you call it. if it just has a table as an argument, that could be anything. but this will tell you exactly what you need to put in when you're typing it. and also you have to type more code when you're passing in a table. i do see a potential reason the other .new() function would be used, but it might be more appropriate to name it something like ".fromTable()" or something like that. i do like the video though, it does explain the basics of object oriented programming, but i think a bit more explanation on methods would help as well. i can see how they would get confusing.
@brawldude2656
9 ай бұрын
But isn't the whole point of metatables and metamethods is to accept whatever you want?
@PurpleLegoPieces
3 ай бұрын
Food.new({}) in the table looks working but it's just waste of memory.
@PurpleLegoPieces
3 ай бұрын
Althought server contains of memory and client doesn't uses that much performance.
Gnome I know you probably won’t see this but remember in your tower defence game I know you probably can’t help but with the collision with the player aren’t working is there any idea why they aren’t?
when's the next gnomejam? I really want to know so I don't enter late like last time
gnome please stop avoiding the doors tutorial
Hi GnomeCode! I Was wondering if you could make a tutorial on making a basketball game in roblox. I would really appreciate it, because there are no tutorials on it, and I think you could easily make one. Thanks!
thank you
When is Part 8 of DOORS Tutorial?
upload more, like do a tds game part 2 tutorials
yo gnomecode can you make a tut how to make a badge giver when you click f9 and then on server and type a code that gives the player the bagde?
Gnome code great
and i oop-
When is the next how to make doors in roblox studio?
Hello, I have a video request. I was wondering if you could make a video explaining how to make it so during a game, any player can change some text, they are expected to type a decal id, then a script detects the id typed by the player, and changes a decal or image on a part or gui.
@Bradenyolo
8 ай бұрын
It's simple but does require a video to make. Here's a sample script (Please indent the lines as I was writing this code on mobile): local InputBox = script.Parent:WaitForChild("InputBox") local ChangeDecalId = script.Parent:WaitForChild("ChangeDecalId") local ChangeDecalImageEvent = game.ReplicatedStorage:WaitForChild("ChangeDecalImage") ChangeDecalId.Activated:Connect(function() local id = tonumber(InputBox.Text) if id == nil then return else ChangeDecalImage:FireServer("rbxassetid://"..tostring(id)) end end)
Hey gnomecode, I know you probably won’t see this, but in the slim chance you do, what is going to happen with the doors series, if you don’t mind me asking, I just wanna know if you will be continuing it.
video 2 of asking for you to review retro studio again because it now has coding and a lot more games
When I watch this without even being able to code anything except for functions.😮
Cool video
Cover more tutorial topics
Hey, when doors tutorials?
Can you record how to make Cheese escape system and Tower defense game (your tutorials is outdated) (Day 1 Waiting)
What are the usages?
I didnt understand very well because we could do all of this stuff just using model function why did we use OOP
Sometimes I don't get the difference between the dot operator and the colon operator. Why is it Instance.new() and not Instance:new() ?
Gnome code can u please start a teddi series nobody wil so can u
and i oop
Object oriented programming makes my head hurt in funny place
Gnome army
Can you pleas make Skins for the Tower Defense. i need they so much so pleas
moral of the lesson: just use python
@Hadev123
8 ай бұрын
It’s Lua in 100 seconds I think it’s actually a pretty good language
@vishkarcorp
6 ай бұрын
@@Hadev123 -compared to other languages commonly used by game frameworks and engines lua is a shitshow and luau is an even bigger shitshow. the only good thing is that its quite performant. but syntax and pattern wise, the fact that you have to use metatables for something simple as OOP is convoluted and doesnt even work properly with luau's type checking system. hopefully luau will add syntactic sugar for class declaration someday
yo its been a while
why use metables when you can still attach functions to tables
But the bit about setting the metatable to itself is... I don't understand why the changes in the code reflect that. Wouldn't changing the index rule to 'food' be enough? Why get rid of the food prototype table? Do you HAVE to get rid of it? Ok so you don't. But the advantage is not having to look up another table. As in... You get all of the values via the food.new constructor if you want, filled values and default. While you can only get specific values or the prototype table the other way. Right. Oh AND you can't use self otherwise. Ok... How does the colon know there is an object(table?) that's got a metatable...? Wait do you need to first do the constructor then. Yeah. Ok. I see. But isn't this only useful if you add new layers of inheritance. Pasta, fruit, stews. And then I guess... You can pass in randomised values? No I still don't understand the point of it... Why have default values and functions? but it is very neat.
what is the point of saying ..index for the "Food" table when you can instead just set the "FoodPrototype" as a metatable
Cool, but we need more tutorial series
im kinda disappointed he ditched the doors series :(
cool
do doors tutorial part 9
I'm still confused.
only in roblox would the average programmer need to learn what OOP is lol
bro holy fucking shit i didnt even know it was possible to drag such a simple concept on this longf
@legendarykatar
10 ай бұрын
@@mattbergman2788 ?
Did I just watch a... Roblox programming tutorial? What langauge is it based on btw? Looks like Python but I'm curious
@GnomeCode
9 ай бұрын
Roblox uses a modified version of the Lua programming language
@wojp0777
9 ай бұрын
Alright, thanks! I'm not into Roblox so I probably won't watch many of videos but good luck with your youtube career!
yo
W
hey Gnome code I hope you see this message but, I have problems with the piggy game, I tried learning from the uncopylocked game but nothing could beat the way you explain, I've been struggling for I while now. if your not gnome code please like so gnome code can see this. your truly -ToastFilms
i am speed
Hi
hello
my bad if your tired of doors comments but why is it taking so long? (I'm not RUSHing you)