In other languages like Java and Python, you can make classes for all sorts of things. You would have to put functions and a constructor. Is there a way to do this in Lua?
Fm_Trick
(Trick)
April 16, 2020, 6:32am
#2
Yes. Lua allows for relatively diverse OOP construction.
Here’s some threads I found using the search feature.
ALL ABOUT OOP!
Prerequisites
An understanding of meta-tables (although the required code will be explained)
How tables work and a competent grasp of the Lua syntax
Parts
What is OOP?
How does it help me?
How do I make this work in Lua?
Integrating with module scripts
What about inheritance?
What is OOP?
OOP stands for Object Orientated Programming and is a way of laying out code in a more friendly way whilst also keeping large projects organised. You have used objects in pro…
As discussed in the previous tutorial, we are given some tools by the Lua language natively to make our lives easier. These are variables, functions, if-statement, loops, etc. For simple scripting, these were good enough. However, as it is the case with any other tools, given the right tools, people start building things that are even more complex. And to combat ever-growing complexity in our code, people have developed different styles of coding. There are a number of approaches such as Procedu…
This project has been deprecated. Although I’ve rewritten this a few times, I’ve ultimately decided it is unnecessary bloat. If others are still interested in this project, I’ll release the rewrites as is.
1 Like