I have a game where I use one module script for functions. I don’t know if multiple modules, each being their own function, or one module, containing a ton of functions.
What are the benefits and complications lying in each of them?
I have a game where I use one module script for functions. I don’t know if multiple modules, each being their own function, or one module, containing a ton of functions.
What are the benefits and complications lying in each of them?
Depends on your style, if you do not like 1 big script then turn it into multiple modules, theres no benefit.
There can be a benefit if you split the functions to its own area, MovementHelper
, ChatHelper
, etc…
That way you can just require the module you require and not immediately get all functions, even those you actually don’t need. Just be sure that you shouldn’t cross-require the modules or else you will get an infinite loop of requiring, causing the entire thing to crash.
I’d like to add that it would probably take longer for a large module to load than a smaller module. And that means it’s possible that if you have multiple smaller ones, maybe the overall time will take longer but you will have access to some modules faster and others slower. It really means nothing since it is just startup initializing, but I thought it’s worth mentioning in case some people find use in it somehow.