Data Sets Better in One Module or Multiple?

I hope this is the right section for this question.

Currently I am making a system for interactable models like doors, items, etc. For each model there will be a set of data/variables that decides how the model is set up or what specific attributes I want it to have.

Should I keep this data in a separate module for each model, or put it together in one big one?

Here are some examples of what I mean:

Separate Module

local module1 = {}

module1.Attribute1 = "Data1"
module1.Attribute2 = "Data2"

return module1

Combined Module

return {
	["module1"] = {
		Attribute1 = "Data1",
		Attribute2 = "Data2"
	},
	["module2"] = {
		Attribute1 = "Data1",
		Attribute2 = "Data2"
	},
	["module3"] = {
		Attribute1 = "Data1",
		Attribute2 = "Data2"
	}
}

Is one better than the other or does it not matter?

Thanks!

it really just depends, if you like short and sweet scripts then use singular modules and a compiler to store all that in a table

if you like one big script where you can access every piece of data from (for example booga’s itemdata system) you can use a combined module

edit: the short and sweet scripts don’t give full inherited autocomplete btw

3 Likes

Depends if you want a big blob of scripts then the first one if you want a couple giant scripts the second one they really dont have a difference on gameplay its just one is easier to read the other one isnt.

1 Like

It’s up to you really, from my understanding there isn’t a major difference perfomance and optimization wise, and it depends on what you find the most comfortable. I’d personally clamp together modules tha contains objects that are similar in function (e.g: doors with gates, cars with boats, etc.)

1 Like

Thank you all for the replies, I think I know what I like best, I just wanted to be sure I was optimizing my choices I think. :smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.