Skript

Skript

788k Downloads

Support unloading scripts without loosing parsing info

skgizsm opened this issue · 2 comments

commented

Suggestion

As of today the unload script effect for unloading a skript is no different from disabling it instead. Only with skript-reflect the unloading effect actually unloads the skripts without changing their file names, which is already very useful, but i would like to suggest that unloading a skript should unload it, but also keep the parse info so that it doesn’t have to re-parse when the file is loaded again (which takes quite a while and may cause lag spikes).

This would not conflict with changes in the file because if someone were to change the skript he would reload it anyways which parses it again.

In addition to this a /sk unload and /sk load command could be added, but this may be over the top and im personally only looking for the effect functionality.

Why?

I have a minigames server and would have found this quite useful for disabling certain minigames skripts that i can quickly enable again when needed without causing wait time or even lag spikes from re-parsing for no reason, especially when it is automatically done with skript.

Other

No response

Agreement

  • I have read the guidelines above and affirm I am following them with this suggestion.
commented

As of today the unload script effect for unloading a skript is no different from disabling it instead.

I would like to note, that when using the unload effect if you have the SCRIPT_REFLECTION experiment enabled, aka using script reflection at the top of the file, it will unload the script and not disable/change the file name. Otherwise, it does go through the disabling process. This is also noted in the description of the effect on the docs.

In addition to this a /sk unload and /sk load command could be added,

This might be a good addition to have in my opinion.

I'm not sure about the unloading and still maintaining the parse info part.

commented

I think 'unloading' something without actually unloading it (since you're keeping the parsed version in memory) would be very sketchy and full of little edge cases and possible bugs. I don't think there's much value in it to counteract the effort and risk. It's also kind of unclear what exactly loaded/unloaded entails if unloaded means that it's still loaded, but not active? I don't think avoiding re-parsing is very beneficial as well-organized and written scripts should not take long to reload and the ones large enough to do so probably should not be dynamically loaded/unloaded on production. Additionally, the asynchronous loading option should fix any freezes you have.