Can you pass a value to a Module Script?
I am currently trying to learn modules so I can use them correctly and effectively, but there is a single line in both the developer and the wiki that reads:
Developer:
"If a ModuleScript is required multiple times in the same environment the return value from the first execution will be used for every require call. "
Wiki:
"ModuleScripts run once and only once per Lua environment and return the exact same value for subsequent calls to require."
This means Module Scripts are purely static and will never change? (like a read-only table)
If that's true, then you can never have code that uses the result of a ModuleScript to perform a comparison operator since the result will always be the same?
math.random cannot be used inside them?
If all of that is true, then I have to ask: why use them? Regular functions and Remote Functions can/will do more. The only things ModuleScripts really seem useful for are storing large amounts of declarations, various constant data, and storing static designs (such as using a script to build something).
Or do I have this all wrong because you can send values to a ModuleScript? I looked everywhere but couldn't find a template on this.
To get around this couldn't you clone the Module Script before you require it, change its name, then destroy the one you required? (Granted this may only work if you only require the Module Script from a single point, and should probably just use a normal function)
6a. If you can, couldn't you use this to effectively hide ALL of your code by uploading it
to Roblox and using the assetID in the require? Or will that cause massive lag
since you'll have to receive data outside of the Server every time you require?
Sorry for so many questions, I'd rather just lump all of them into one.