What the hell is object oriented programming?!?!?!? [Solved]

I am pretty dumb and my english understanding skills are very poor so in the most easiest way possible what is roblox LuaU OOP and how to understand it?
_G? bruh I got no idea…

(please dont question my knowledge :frowning: )

1 Like

I know that you are not expecting to get a message from someone who doesn’t know OOP either, but I do know slightly about the “_G” keyword.

Simplest definition: “A variable that you can use in any script”


Script 1:

_G.Money = 50

if _G.Money < 60 then
    print(_G.Money, "is less than 60")

Script 2:

if _G.Money > 40 then -- _G.Money still equals 50
    print(_G.Money, "is greater than 40")

Hope you learnt something knew.

yep i did thank you ill wait for more answers to pop up and as there are more than 1 solutions yea cant really pick one still thanks for that!

Object oriented programming is when you create your own classes that can be used multiple times over again, also please do not scream in your posts.

1 Like

hmmm ok

I see no rule being broken.

No broken rules, it’s called readability.

1 Like

I dont scream often its just when I am confused so yea. If no rules then I see no problem here readability people can still read it.

Object oriented programming is when you create your own classes that can be used in multiple scripts over again. Object oriented programming makes code more organized, easier to manage, and make readability better. There are concepts to object oriented programming like abstraction, inheritance, polymorphism, and encapsulation.

The concepts, you can learn anywhere on youtube. For example, just search up, “What is abstraction in programming” or “What is polymorphism in programming” and you will get a lot of videos. In roblox, you use metatables for object oriented programming. If you want to learn more about it, just watch some youtube videos about object oriented programming concepts and ideas in any programming lanaguge and watch videos or read other posts on the devforum on how to use object oriented programming on roblox.

1 Like

This post does a great job of explaining what it is and how to use it

genfenv is a function that returns any global function and variable. For example

local hi1 = "hi" --This is a local variable not a global one
hi2 = "hi" --This is a global variable not a local one

print(genfenv()) --Returns only hi2 not hi1 because hi2 is a global variable

Alright thank you all! For telling me!