Require a Module from command bar on not playing mode

When creating specialized tables dynamically getting data from modules by running code in the command bar, I get a expectable issue.

Once you require a module once it gets allocated in memory of the server, and if you require it when Studio is not on game mode (testing) it causes the same (but, the pc being the server, and no testing mode, the entire studio session keeps it allocated in memory), the next time you require it, it still has the “old” information from the time you first required it, and it doesn’t contain the new edits.
The only way to get the new data is by closing studio and opening it again, or creating a new module cloning the previous one.

Is there a way to delete it from memory in an easier way?

(It doesnt matter if its not, I have many other ways to accomplish my workflow, I just wanted to know if someone knows some info about this)

It’s late at night so this may not be the best solution. It’s also untested but theoretically should work.

Instead of requiring the module directly:

require(MODULE)

You may be able to clone it just before using require(), such that each time you are calling require on a new module script, with the updated code.

require(MODULE:Clone())
1 Like

Press “Reload Script” in the Script tab in Studio when you make a change.

image

3 Likes

I’m sort of lost… so you’re requiring a modulescript via the commandline, but your issue is that it persists between testing sessions?

@batteryday and @SeargentAUS both ways works, thank you so much! I think I would go with the “Reload Script” button, sounds more “normal”, but the :Clone actually works too.

No, only during the current session, thats why I said that closing and opening studio again did flush the module. And its not on TestingMode, its by requiring it when studio is doing nothing, lets call it “build” mode when you are writing a script, not test mode

1 Like

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