Will it work if I try to require() it again?
Why even disallow this from being done in the first place? It doesnât have any significant negative impacts on the game and will do more harm than good to developers.
And, you can require the module before destroying it as mentioned in a previous post, so whatâs the point in even doing this then?
No, it will throw an error.
Itâs fixes one of the memory leaks on the whole platform.
Unlikely. Just donât destroy a module if you plan to require it again.
How would this cause a memory leak? Iâm pretty sure it should be GCâd if there are no references to the module left. If a script holds a reference to it, then the module should work normally.
What? Is there no other way to prevent this from memory leaking? Do you really have to completely prevent it from being done altogether?
You say this whilst having a vague grasp of how often it is used, as only a few developers have commented on this page.
why should using require() on a module that has been previously required and subsequently destroyed cause require to error? if the module has been required and is running and continues to run after it is destroyed, why should require() error on it as if there is an issue with it when there is actually no issue?
mate, if it was already destroyed you canât even import it anyways
also who relies on this behavior, literally no one (unless you do not care about memory leaks like a pro!!! )
um actually require() works perfectly fine if you have a variable for the module and works as usual as long as you dont have any descendants in it that it depends on
If it wasnât intentional then it wouldnât work. Also, the basis of common knowledge is subjective.
*Scripting
Three years is not enough to know every minute aspect of LuaU, especially due to it still being constantly developed.
It was obviously an obscure bug?
I do know other langs, ands they arenât just scripting languages.
You can never know, how can you expect that?
it seemed more like an intentional thing to me idk it just always kinda clicked to me that yeah it behaves like that so it looks more like intended behavior to me
Itâs not a bugâŚ
The limitations of memory.
Destroy means to get rid of and no longer use. If you wanted to require it again just donât remove it.
Using it as a way to protect your game will literally do nothing, exploiters can access anything local.
i use this behavior to protect server scripts on script executor games so it does protect the game
Thatâs literally what a bug is though? Itâs unintentional, but it will occur. Only Roblox has the analytics to say that this issue is causing a memory leak.
Clearly it is, they are fixing (or âImprovingâ as the Release Notes say) the behaviour because it was not their intention for modules to be requirable after it has been âdestroyedâ (which logically would mean gotten-rid-of).
It just doesnât make sense to me, why would you get rid of something you are actively using?
??? At the end of the day, the sentence âscripting behaviourâ and âprogramming behaviourâ are practically identical and convey the exact same message, no matter the small semantic difference between them.
Why not prevent them from require
ing modules outside a certain scope? If they donât need to, then why not prevent them from calling require
at all? What if a script runs after a module it needs to require is deleted?
Being able require something after it has been destroyed is like the dumbest thing ever. When I say Destroy(), I really mean destroy this object and remove it from memory.
Could there not be a Enabled property on module scripts, the same way normal scripts have?
Or a similar property that when toggled determines whether the module is âfrozenâ or not. The module is paused (not restarted unlike scripts), and any requires are rejected. If there are no references to the module, as in its been deleted and all previously accepted require references have been gcâd, and this property is enabled then the whole module is gcâd rather than left to run in the background.
I think a better property would be a RunContext property
Sorry for the bump, will this behaviour also be true for modules loaded through require(assetId)
?
It wouldnât make sense to make this error because you could simply destroy that script (get the ModuleScript through getfenv
or ScriptContext.Error
) and make the module completely unusable.
But why would you destroy your module and make it unusable for yourself?
If you have malicious/virus code in your experience destroying modules, thatâs already a bigger problem.
Iâm probably misunderstanding the use case here.