How does one read code from another piece of code?

So, what I’m basically trying to do is read code (whether it be a LocalScript, Script or ModuleScript) from a module. What I’m trying to get out of this is how should I go about this? Sorry for the lack of text but I can’t really expand on it as such. Feedback is appreciated, thanks for reading.

Use case: For Encrypting scripts through a module.

Script.Source is the only way to read the contents of a LuaScriptContainer, however this is only usable via the command line or plugins.

Normally you’d do something like LuaSourceContainer.Source but the source happens to be a protected string so there’s no way to check another script’s content at runtime. What’s your use case? Maybe there’s a simpler way

Whoop ninja’d

If you gave an example of why you want to do this, maybe we can provide you a better answer. In most cases you’re not interested in reading the actual code of the script (as mentioned by the two previous posters), but rather the output of the script (ie. the return value of the ModuleScript, or any functions returned by it).

1 Like

With my new found knowledge of Script.Source (thanks for that one @return_end1!), I’m pretty much looking for a workaround which can do the same but isn’t restricted.

1 Like