Ok, so let’s take the case of a grid based game, perhaps a match 3 game like Candy Crush, or maybe a linker game such as Blossom Blast.
Now if you’re an OOP guy you probably decide that you need a base class of some kind to represent the stuff in the grid right? Perhaps we call it Entity. And Entity can either be a Blocker or a Candy. A Blocker can be a Chocolate or a Licorice. A Candy can either be a Colored Candy or a Special Candy. A Colored Candy can be one of Red, Orange, Yellow, Green, Blue, Purple. A Special Candy can be a Color Bomb, Fish, Striped or Wrapped.
The OOP solution would probably be to create a large class hierarchy with a bunch of abstract classes to represent this data and let the grid have references to instances of your base class. And when you manipulate the data you have a bunch of checks such as instanceof, isBlocker, isCandy, getColor, getType and so one. Essentially a lot of queries down to the subclasses and the actual implementations. The data is spread out among and carried by your objects.
If you replicate the above in Defold you might have a bunch of different game objects and factories to represent the different types of candies and other entities on the grid. Each game object might have one or more scripts with a bunch of go.property() declarations to hold the data. The grid would hold only the game object ids and when you need to query the grid for the property of a certain entity you do calls to go.get() to read the properties of the scripts.
In the data driven approach, which I prefer, I’d have the grid and it’s contents stored in a single place. The grid would have a table per entity and each entity table on the grid would hold all the information about it, such as type, color and a game object id. I’d use a single game object with a sprite and let the game object function only as a visual representation of the data, not a carrier of the actual data. Having all of the data in one place makes it very easy to iterate over the grid, filter it and so on. Querying for a specific property is faster than a go.get() call. It does also make it very easy to serialise the game state.
The above doesn’t always hold true but I prefer to try and keep my data in one place. Sometimes it makes sense, sometimes it doesn’t. In the case of a weapons system it’s not as obvious in my mind which is the best approach. What you suggest @ross.grams sounds reasonable as well. Personally I prefer to keep the data in a table since it’s easier to tweak and easier to get an overview of the whole thing. Thinking ahead it also makes it easier to updated the data from some source (a JSON blob downloaded from somewhere perhaps), although that will not be the case when Live Update supports updating of existing content. One benefit of the go.property() approach on the other hand is that the data is exposed as properties in the editor which is more designer friendly than changing stuff in a JSON file or a Lua tabnle.