Aha. I see you're hard at work on your very own solution! Allow me to give a tip or 5
Today we'll talk a little about OOP or Object Oriented Programming. Now, in lua, OOP is a little different than in other more popular OOP languages such as JAVA.
So for you guys out there who would say lua doesnt have oop... You probably know better than me. With that said lets learn some stuff about simulating OOP in lua.
First off there are tables. myTable = {}. In lua tables are used as objects because every table created is unique. Not table references though. i.e. myTableA = myTable, this is referencing myTable.
With this in mind we can create objects with behavior relevant to that object. Still following? Example:
If you notice the Bob object has specific fields, name and age, that identify him. The fields arent so unique but the Bob object is.
Bob isnt very flexible as an object though. This brings me to Classes. Classes are Objects. But, they are not the same as lets say Bob.
Bob is an instance of a Class. We usually wont interact with a class like we would an instance of a class. For example:
Now for my main point.. Buttons. Buttons are a class. We want uniqueness and specified behavior.
I hope this will help you understand the power of OOP like design and some of the more basic ways to use it
As usual any questions or elaborations by others are welcome. If someone else can explain better please do! lua is my first language!