What is Object Oriented Progamming?

Поділитися
Вставка
  • Опубліковано 26 лис 2024

КОМЕНТАРІ • 166

  • @nanifiqueyt
    @nanifiqueyt 9 місяців тому +12

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

  • @Recodetfort0
    @Recodetfort0 Рік тому +25

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

  • @n3o.l1
    @n3o.l1 Рік тому +88

    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 Рік тому +8

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

    • @EarthItself
      @EarthItself Рік тому +5

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

    • @neut_ro
      @neut_ro Рік тому

      @Magic_Blox same bro

    • @MeinDasIstGut
      @MeinDasIstGut Рік тому

      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 Рік тому +2

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

  • @JohnToaster
    @JohnToaster Рік тому +11

    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

  • @weylinstoeppelmann9858
    @weylinstoeppelmann9858 Рік тому +9

    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

  • @2tukar
    @2tukar Рік тому +4

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

  • @Brawlstriker89
    @Brawlstriker89 7 місяців тому

    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.

  • @jsnotlout3312
    @jsnotlout3312 Рік тому +3

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

  • @gabom103
    @gabom103 Рік тому +2

    This video is really interesting and helpful, thanks GnomeCode.

  • @Totominator93
    @Totominator93 Рік тому +1

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

  • @candykid44
    @candykid44 Рік тому +6

    ok this was a video I actually needed

  • @LuminosityZero
    @LuminosityZero Рік тому +2

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

  • @bartoken
    @bartoken 11 місяців тому

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

  • @notdaycrucial5179
    @notdaycrucial5179 Рік тому +2

    Love these videos. Thanks gnome code!

  • @PUMCAM12
    @PUMCAM12 Рік тому +2

    Great beginner tutorials you are creating!

  • @MarzFromMars
    @MarzFromMars Рік тому

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

  • @vileto_a
    @vileto_a Рік тому

    This really did help me on what metatables are!

  • @74L
    @74L Рік тому

    Exactly what I was thinking of learning next!

  • @HafuPlayStuff
    @HafuPlayStuff Рік тому +1

    thank you, now i understand how metatables are working

  • @inconnn
    @inconnn Рік тому +13

    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 Рік тому +1

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

    • @Astrolightation
      @Astrolightation 9 місяців тому

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

    • @Astrolightation
      @Astrolightation 9 місяців тому

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

  • @GigaGnome
    @GigaGnome Рік тому +2

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

  • @wonsole
    @wonsole 3 місяці тому +1

    1 year and bro has NOT noticed the typo

  • @NeverEverFaceTheDark
    @NeverEverFaceTheDark 7 місяців тому

    This video is actually incredibly good

  • @도경이-t2l
    @도경이-t2l Рік тому

    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

  • @aarongamerph
    @aarongamerph Рік тому +2

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

  • @embry4117
    @embry4117 Рік тому +2

    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)

  • @pacspecific
    @pacspecific 2 місяці тому

    I learned about OOP almost 5 years ago.

  • @itsnamehere
    @itsnamehere Рік тому

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

  • @BasedOnBrian
    @BasedOnBrian Рік тому

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

  • @WindyPivot
    @WindyPivot 6 місяців тому

    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)

  • @PinxIsMe
    @PinxIsMe Рік тому

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

  • @sonickirb
    @sonickirb Рік тому

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

  • @Im_IntoDev
    @Im_IntoDev Рік тому

    Nice beginner tutorials you are creating!

  • @fnafmemeguy6984
    @fnafmemeguy6984 Рік тому +1

    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?

  • @ABlueThing
    @ABlueThing Рік тому

    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

  • @Rocush
    @Rocush Рік тому +2

    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.

  • @yes.5110
    @yes.5110 Рік тому

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

  • @CreatorreaTDS
    @CreatorreaTDS Рік тому +1

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

  • @JustBey
    @JustBey 4 місяці тому +1

    So metatables are only useful for storing functions and heavily orginize your code.

  • @MagmaRoblox1
    @MagmaRoblox1 Рік тому

    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

  • @NathanielThomas-v5r
    @NathanielThomas-v5r Рік тому +1

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

  • @nzeust
    @nzeust Рік тому

    gnome please stop avoiding the doors tutorial

  • @salthal
    @salthal Рік тому

    that was very helpful thank you

  • @bober3706
    @bober3706 12 днів тому

    I really dont understand this Food.__index = Food. Like if you are searching a table and you cant find indexed element you search it agian in infinite loop?

  • @dise8785
    @dise8785 Рік тому

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

  • @botnumb39
    @botnumb39 Рік тому +1

    Great video

  • @NamLeNgoc-yf4mq
    @NamLeNgoc-yf4mq 2 місяці тому

    I'm learning it in my school rn :D

  • @fusion.studioX
    @fusion.studioX 3 місяці тому

    i dont understand how does it know that you can call the eat function for myOtherFood

  • @crypticsh0ot53
    @crypticsh0ot53 Рік тому

    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.

  • @Sleep-f1w
    @Sleep-f1w Рік тому

    I want to see a hungry pig tutorial video!

  • @Sasuke46525
    @Sasuke46525 11 місяців тому

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

  • @AkamiChannel
    @AkamiChannel 10 місяців тому

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

  • @mile.9768
    @mile.9768 Рік тому

    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 10 місяців тому

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

    • @wonny5306
      @wonny5306 2 місяці тому

      Use metatable over the new constructor ;)

  • @Hanselkek
    @Hanselkek 5 місяців тому +1

    Can you do inheritance and composition?

  • @BSSMacroless
    @BSSMacroless Рік тому

    why use metables when you can still attach functions to tables

  • @eddiehazard3340
    @eddiehazard3340 5 місяців тому

    usually your videos are the best... but we couldn't follow this one too well.

  • @askshells
    @askshells Рік тому

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

  • @epickid_4996
    @epickid_4996 Рік тому

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

  • @SUSSYBAKA-fq2ut
    @SUSSYBAKA-fq2ut Рік тому

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

  • @Erolsaurus
    @Erolsaurus Рік тому

    Thanks!

  • @Mivxor
    @Mivxor Рік тому

    wow, this might be what i need to buss

  • @jokesflyovermyhead7491
    @jokesflyovermyhead7491 Рік тому

    That's what I needed

  • @FireFuzzball673
    @FireFuzzball673 11 місяців тому

    Thank you

  • @NeverEverFaceTheDark
    @NeverEverFaceTheDark 7 місяців тому

    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.

  • @yoskinny
    @yoskinny Рік тому

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

  • @abdalrahamnabbasi
    @abdalrahamnabbasi 6 місяців тому

    is the metatable same as inheritance in c++ oop?

  • @apro8723
    @apro8723 Рік тому

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

  • @Childwhoisdum
    @Childwhoisdum Рік тому

    thank you

  • @Cris-im6pl
    @Cris-im6pl Рік тому

    Object oriented programming makes my head hurt in funny place

  • @PAPABINGBONG1334
    @PAPABINGBONG1334 Рік тому

    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?

  • @nubbyx8096
    @nubbyx8096 Рік тому

    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!

  • @roganlowerson6221
    @roganlowerson6221 Рік тому

    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 Рік тому

      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)

  • @cookie3909
    @cookie3909 Рік тому

    So useful!

  • @iplaytday9081
    @iplaytday9081 Рік тому

    love ur vids 😂

  • @DaToastFilms
    @DaToastFilms Рік тому +3

    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

  • @mile.9768
    @mile.9768 11 місяців тому

    What are the usages?

  • @C_yber
    @C_yber Рік тому

    Gnome code great

  • @Flrere
    @Flrere 9 місяців тому

    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

  • @legendarykatar
    @legendarykatar Рік тому

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

  • @anajotz
    @anajotz Рік тому

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

  • @CatRapper1
    @CatRapper1 Рік тому

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

  • @matrixgeg
    @matrixgeg 6 місяців тому +2

    best tutorial i ever found❤❤

    • @로좋
      @로좋 6 місяців тому

      For real

  • @ValidityValue
    @ValidityValue Рік тому

    Hey, when doors tutorials?

  • @Zamilbotw
    @Zamilbotw Рік тому

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

  • @BrandonMilazzo
    @BrandonMilazzo Рік тому

    Cover more tutorial topics

  • @matx4044
    @matx4044 Рік тому

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

  • @truestbluu
    @truestbluu Рік тому

    I'm still confused.

    • @lembarkii8669
      @lembarkii8669 5 місяців тому

      are you still confused?

    • @truestbluu
      @truestbluu 5 місяців тому

      @@lembarkii8669 I've got the hang of it now :)

  • @Disksjw
    @Disksjw Рік тому

    im kinda disappointed he ditched the doors series :(

  • @EATBADGE
    @EATBADGE Рік тому

    yo its been a while

  • @funnydogreal
    @funnydogreal Рік тому +2

    moral of the lesson: just use python

    • @Hadev123
      @Hadev123 Рік тому

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

    • @vishkarcorp
      @vishkarcorp Рік тому

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

  • @RobloxHideandSeek199
    @RobloxHideandSeek199 Рік тому

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

  • @yeetmanmega
    @yeetmanmega Рік тому

    upload more, like do a tds game part 2 tutorials

  • @DiamondBor
    @DiamondBor Рік тому

    Cool video

  • @ScripterDan
    @ScripterDan 10 місяців тому

    and i oop-

  • @piedoge5976
    @piedoge5976 Рік тому

    and i oop

  • @lucasmikael9199
    @lucasmikael9199 Рік тому

    do doors tutorial part 9

  • @wojp0777
    @wojp0777 Рік тому

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

    • @GnomeCode
      @GnomeCode  Рік тому +2

      Roblox uses a modified version of the Lua programming language

    • @wojp0777
      @wojp0777 Рік тому

      Alright, thanks! I'm not into Roblox so I probably won't watch many of videos but good luck with your youtube career!

  • @TheHuggy
    @TheHuggy Рік тому +2

    Cool, but we need more tutorial series

  • @mrSEEK_official
    @mrSEEK_official Рік тому

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

  • @vishkarcorp
    @vishkarcorp Рік тому

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