Hello everyone, in this post I would like to know if in roblox studio you use classes, methods, constructors of a class, objects and call the methods?
The reason for my question is the following: I am learning lua in a programming course and the truth is I would love to know your opinions about it, I remain attentive to your answers, greetings.
I would argue that Lua is more of a dynamic programming language rather than a object-oriented language. This is because Lua is not what you would call a “strict” language, compared to something more suited for object oriented programming like Java. What I mean is, when we write code in Lua, the compiler does not just automatically “scan” the code and see if there is any issues with the code. Rather, we can only see the errors and bugs in the program when the code is actually executed. On the other hand, in a language like Java, we are able to see errors or potential problems in our code right from compilation.
However, Lua does have its own implementation of object-oriented programming, and this is achieved through metatables and metamethods. So yes, to be blunt, we can create classes an objects with their own properties and methods, as well as simulate behaviours such as inheritance, encapsulation, and delegation. But I personally don’t think Lua is the best suited language for object-oriented programming; as mentioned before, there is no type checking in Lua compared to static languages (with an exception to Roblox’s implementations here). But nonetheless, you can do pretty cool stuff with metatables, and it doesn’t hurt to practice Object-Oriented Programming with Lua.