Does requiring module with giant dictionary at 2+ scripts will use more memory?

Hello guys. I’m trying to make inventory system. But my game have a lot of diffirent things: trees, stones, plants and etc. But every part of game uses certain properties for them, like:
Inventory need:

  1. Size
  2. Material
  3. Color
  4. Weight

Tree grow system need:

  1. Size
  2. Material
  3. Color
  4. Health
  5. Tree chain length
  6. and some others.

And I have rn like 1k items, if not more. And I want to organize everything with module scripts. But, when I started to do this, I got question - is usage of module will consume N amount of memory, where N is amount of requires (uses), or it will just consume memory once?
I need to know this, because I may need to split this data in diffirent modules, because, for example, inventory module needs less data than tree grow system.

The more data you have in a module then yes the more memory is being used, it probably wouldnt make much of a difference splitting them up other than for organization purposes,

When you require a module it loads it into memory

I am really unsure what your asking in terms of the memory stuff…

Overall, the one size fits all solution would be a system utilizing inheritance and abstraction. While luau is not natively object orientated you can replicate the behavior of object oriented programming and datastructure with metadata.

That’s an around half a megabyte of storage maximum. All required modules are cached, meaning that requiring it won’t create a totally new table; it will just pull it from memory. Raw data is usually never a memory eater. Image textures and sounds are.

2 Likes