Thoughts on using Modules as temporary data holders?

Recently I’ve been wondering how to temporarily store larger chunks of data while making it accessible to other scripts

The same way people use attributes on things or stuff like that

I’ve read attributes are faster than instance Values in terms of memory, although not being able to hold as many types of values

And I’ve also read long time ago, that accessing modules from many scripts could cause issues, is that true?

If I had to give an example, making a player placement system and or other more complicated types of system where the data is hard to save, it seems module scripts would be good for those, but im wondering how efficient is it really.

Thoughts? :thinking:

It sounds like ModuleScripts are your friend here. I’m not familiar at all with performance concerns about them. They cache the returned value every time the module is required, so it’s not like you’re consuming any more resources with each script that depends on it.

Large chunks of data usually won’t blend well with ValueObjects or attributes. Attributes are great for containing mostly state, I would say. ValueObjects like you said fill in the gaps attributes have (storing instance values.)

ModuleScripts is the ideal approach here. I usually write managers that cache data and then send out that data when requested from external systems.

Go crazy :slight_smile:

3 Likes

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