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

  • @n3o.l1
    @n3o.l110 ай бұрын

    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

    @mysyvcic

    10 ай бұрын

    metatables are so complicated to the point i dont even care about them

  • @EarthItself

    @EarthItself

    9 ай бұрын

    @@mysyvcic they are REALLY useful in the right situations tho

  • @neut_ro

    @neut_ro

    9 ай бұрын

    @Magic_Blox same bro

  • @MeinDasIstGut

    @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

    @ahmed-music-prod

    8 ай бұрын

    ​@@mysyvcic exactly like its just easier not even using them lmao

  • @Recodetfort0
    @Recodetfort09 ай бұрын

    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!))))

  • @weylinstoeppelmann9858
    @weylinstoeppelmann98589 ай бұрын

    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

  • @DietBurrito
    @DietBurrito10 ай бұрын

    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

  • @2tukar
    @2tukar9 ай бұрын

    thank you so much gnomecode, ive been trying to learn about oop for so long, and this finally put logic in my head

  • @DynastySheep
    @DynastySheep2 ай бұрын

    Showing 'workspace' with its methods and functions really gave me the spark of understanding OOP more.. thanks

  • @Brawlstriker89
    @Brawlstriker89Ай бұрын

    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.

  • @user-xz2bh2tg8p
    @user-xz2bh2tg8p9 ай бұрын

    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

  • @Thorn_CoruscantGuard
    @Thorn_CoruscantGuard10 ай бұрын

    Yay an another vid, TYSM gnomecode for all things you make for us 👍

  • @gabom103
    @gabom10310 ай бұрын

    This video is really interesting and helpful, thanks GnomeCode.

  • @74L
    @74L10 ай бұрын

    Exactly what I was thinking of learning next!

  • @Flrere
    @Flrere2 ай бұрын

    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

  • @notdaycrucial5179
    @notdaycrucial517910 ай бұрын

    Love these videos. Thanks gnome code!

  • @embry4117
    @embry411710 ай бұрын

    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)

  • @parkersultimateminecraftch660
    @parkersultimateminecraftch66010 ай бұрын

    Great beginner tutorials you are creating!

  • @bartoken
    @bartoken5 ай бұрын

    this is 100% the best channel for learning scripting. This helped me so much

  • @jsnotlout3312
    @jsnotlout33129 ай бұрын

    Super useful! I need to use module scripts more often, I always forget how useful they are.

  • @vileto_a
    @vileto_a10 ай бұрын

    This really did help me on what metatables are!

  • @alephzero404
    @alephzero40410 ай бұрын

    I was literally saying “oop” right before you said it

  • @MarzFromMars
    @MarzFromMars9 ай бұрын

    Nice I’ve been wanting to learn metatables for a while!

  • @Im_IntoDev
    @Im_IntoDev10 ай бұрын

    Nice beginner tutorials you are creating!

  • @NeverEverFaceTheDark
    @NeverEverFaceTheDarkАй бұрын

    This video is actually incredibly good

  • @itsnamehere
    @itsnamehere10 ай бұрын

    w vid bro this finally solved my confusion (especially metatables lol)

  • @candykid44
    @candykid4410 ай бұрын

    ok this was a video I actually needed

  • @mysyvcic

    @mysyvcic

    10 ай бұрын

    same here

  • @matrixgeg
    @matrixgeg8 күн бұрын

    best tutorial i ever found❤❤

  • @HafuPlayStuff
    @HafuPlayStuff10 ай бұрын

    thank you, now i understand how metatables are working

  • @BasedOnBrian
    @BasedOnBrian10 ай бұрын

    Thx man! I know how to use self now since I get confused all the time

  • @PinxIsMe
    @PinxIsMe9 ай бұрын

    By far the best OOP video on roblox ever made. 💖

  • @MagmaBloxYT
    @MagmaBloxYT10 ай бұрын

    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

  • @salthal
    @salthal7 ай бұрын

    that was very helpful thank you

  • @sonickirb
    @sonickirb10 ай бұрын

    no way i see a gnome code video 8 minutes after its uploaded 🥳

  • @aarongamerph
    @aarongamerph10 ай бұрын

    Maybe completing the collection by also doing a tutorial on Functional Programming?

  • @iplaytday9081
    @iplaytday908110 ай бұрын

    love ur vids 😂

  • @nas1373
    @nas13739 ай бұрын

    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

  • @GigaGnome
    @GigaGnome10 ай бұрын

    I am 2 seconds in the the video and already love it! It helped me cure my illness!

  • @GnomeCode

    @GnomeCode

    10 ай бұрын

    Wonderful

  • @SUSSYBAKA-fq2ut
    @SUSSYBAKA-fq2ut10 ай бұрын

    We need a tower defense tutorial for skins lol but im pretty sure you are done with that series

  • @mile.9768
    @mile.97687 ай бұрын

    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

    @AngelofSweden

    3 ай бұрын

    Not sure how that would work as Lua is not a typed language.

  • @jokesflyovermyhead7491
    @jokesflyovermyhead749110 ай бұрын

    That's what I needed

  • @Erolsaurus
    @Erolsaurus9 ай бұрын

    Thanks!

  • @cookie3909
    @cookie390910 ай бұрын

    So useful!

  • @botnumb39
    @botnumb3910 ай бұрын

    Great video

  • @ABlueThing
    @ABlueThing9 ай бұрын

    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

  • @dise8785
    @dise878510 ай бұрын

    I know you already did a piggy series, but you should make one of those maze games like cheese escape

  • @CreatorreaTDS
    @CreatorreaTDS10 ай бұрын

    Santa tell me... Will you get in beeeed?

  • @WindyPivot
    @WindyPivot14 күн бұрын

    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)

  • @yes.5110
    @yes.51109 ай бұрын

    how to make a purchase prompt for catalog items and clothes appear when text button gui is clicked

  • @dolly9439
    @dolly94399 ай бұрын

    Could you please make a breakdown for creating party system thank you

  • @user-hd1vp3jc5b
    @user-hd1vp3jc5b9 ай бұрын

    Idea:💡 Can you please make a video on how to script plugins?

  • @HXRH67
    @HXRH6710 ай бұрын

    wow, this might be what i need to buss

  • @Rocush
    @Rocush5 ай бұрын

    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.

  • @FireFuzzball673
    @FireFuzzball6735 ай бұрын

    Thank you

  • @user-vy8nv4wk7y
    @user-vy8nv4wk7y10 ай бұрын

    I want to see a hungry pig tutorial video!

  • @inconnn
    @inconnn9 ай бұрын

    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

    @brawldude2656

    9 ай бұрын

    But isn't the whole point of metatables and metamethods is to accept whatever you want?

  • @PurpleLegoPieces

    @PurpleLegoPieces

    3 ай бұрын

    Food.new({}) in the table looks working but it's just waste of memory.

  • @PurpleLegoPieces

    @PurpleLegoPieces

    3 ай бұрын

    Althought server contains of memory and client doesn't uses that much performance.

  • @fnafmemeguy6984
    @fnafmemeguy69849 ай бұрын

    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?

  • @apro8723
    @apro87239 ай бұрын

    when's the next gnomejam? I really want to know so I don't enter late like last time

  • @avocadoslicr17
    @avocadoslicr1710 ай бұрын

    gnome please stop avoiding the doors tutorial

  • @nubbyx8096
    @nubbyx80969 ай бұрын

    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!

  • @Childwhoisdum
    @Childwhoisdum10 ай бұрын

    thank you

  • @CrazybenPlaysLOL
    @CrazybenPlaysLOL9 ай бұрын

    When is Part 8 of DOORS Tutorial?

  • @yeetmanmega
    @yeetmanmega10 ай бұрын

    upload more, like do a tds game part 2 tutorials

  • @PAPABINGBONG1334
    @PAPABINGBONG13349 ай бұрын

    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?

  • @C_yber
    @C_yber10 ай бұрын

    Gnome code great

  • @ScripterDan
    @ScripterDan4 ай бұрын

    and i oop-

  • @GoIdappI555
    @GoIdappI5559 ай бұрын

    When is the next how to make doors in roblox studio?

  • @roganlowerson6221
    @roganlowerson62219 ай бұрын

    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

    @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)

  • @crypticsh0ot53
    @crypticsh0ot539 ай бұрын

    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.

  • @anajotz
    @anajotz9 ай бұрын

    video 2 of asking for you to review retro studio again because it now has coding and a lot more games

  • @epickid_4996
    @epickid_499610 ай бұрын

    When I watch this without even being able to code anything except for functions.😮

  • @DiamondBor
    @DiamondBor10 ай бұрын

    Cool video

  • @user-wu2kr5uk7z
    @user-wu2kr5uk7z10 ай бұрын

    Cover more tutorial topics

  • @ValidityValue
    @ValidityValue9 ай бұрын

    Hey, when doors tutorials?

  • @matx4044
    @matx40449 ай бұрын

    Can you record how to make Cheese escape system and Tower defense game (your tutorials is outdated) (Day 1 Waiting)

  • @mile.9768
    @mile.97684 ай бұрын

    What are the usages?

  • @Sasuke46525
    @Sasuke465255 ай бұрын

    I didnt understand very well because we could do all of this stuff just using model function why did we use OOP

  • @AkamiChannel
    @AkamiChannel3 ай бұрын

    Sometimes I don't get the difference between the dot operator and the colon operator. Why is it Instance.new() and not Instance:new() ?

  • @nomanhai
    @nomanhai9 ай бұрын

    Gnome code can u please start a teddi series nobody wil so can u

  • @piedoge5976
    @piedoge597610 ай бұрын

    and i oop

  • @Cris-im6pl
    @Cris-im6pl9 ай бұрын

    Object oriented programming makes my head hurt in funny place

  • @_G.Based_
    @_G.Based_9 ай бұрын

    Gnome army

  • @RobloxHideandSeek199
    @RobloxHideandSeek1999 ай бұрын

    Can you pleas make Skins for the Tower Defense. i need they so much so pleas

  • @funnydogreal
    @funnydogreal9 ай бұрын

    moral of the lesson: just use python

  • @Hadev123

    @Hadev123

    8 ай бұрын

    It’s Lua in 100 seconds I think it’s actually a pretty good language

  • @vishkarcorp

    @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

  • @EATBADGE
    @EATBADGE10 ай бұрын

    yo its been a while

  • @BSSMacroless
    @BSSMacroless7 ай бұрын

    why use metables when you can still attach functions to tables

  • @NeverEverFaceTheDark
    @NeverEverFaceTheDarkАй бұрын

    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.

  • @askshells
    @askshells6 ай бұрын

    what is the point of saying ..index for the "Food" table when you can instead just set the "FoodPrototype" as a metatable

  • @TheHuggy
    @TheHuggy10 ай бұрын

    Cool, but we need more tutorial series

  • @Disksjw
    @Disksjw9 ай бұрын

    im kinda disappointed he ditched the doors series :(

  • @scalewreckteam
    @scalewreckteam10 ай бұрын

    cool

  • @lucasmikael9199
    @lucasmikael919910 ай бұрын

    do doors tutorial part 9

  • @truestbluu
    @truestbluu7 ай бұрын

    I'm still confused.

  • @vishkarcorp
    @vishkarcorp6 ай бұрын

    only in roblox would the average programmer need to learn what OOP is lol

  • @legendarykatar
    @legendarykatar10 ай бұрын

    bro holy fucking shit i didnt even know it was possible to drag such a simple concept on this longf

  • @legendarykatar

    @legendarykatar

    10 ай бұрын

    @@mattbergman2788 ?

  • @wojp0777
    @wojp07779 ай бұрын

    Did I just watch a... Roblox programming tutorial? What langauge is it based on btw? Looks like Python but I'm curious

  • @GnomeCode

    @GnomeCode

    9 ай бұрын

    Roblox uses a modified version of the Lua programming language

  • @wojp0777

    @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!

  • @me.ronkon
    @me.ronkon10 ай бұрын

    yo

  • @insertusernamehere8125
    @insertusernamehere812510 ай бұрын

    W

  • @DaToastFilms
    @DaToastFilms10 ай бұрын

    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

  • @abyssguardian
    @abyssguardian10 ай бұрын

    i am speed

  • @epickid_4996
    @epickid_499610 ай бұрын

    Hi

  • @SuperCactusDude
    @SuperCactusDude10 ай бұрын

    hello

  • @mrSEEK_official
    @mrSEEK_official10 ай бұрын

    my bad if your tired of doors comments but why is it taking so long? (I'm not RUSHing you)