Iris icon indicating copy to clipboard operation
Iris copied to clipboard

Have Iris early return in init instead of error

Open JakeyWasTaken opened this issue 8 months ago • 1 comments

If you call Iris.Init() multiple times instead of it asserting it should just early return Iris, I think assertion for shutdown is fair enough as that could be obscure behaviour but early returning for multiple init's would cause no behaviour changes.

JakeyWasTaken avatar Apr 26 '25 17:04 JakeyWasTaken

I'll try and see why the current behaviour is like this, although most of the time modules should only be instantiated once, and generally it's up to the person to check if that has happened.

SirMallard avatar Apr 27 '25 14:04 SirMallard

The only thing is that the variable used to track if iris has already been initialised is Internal._started, which isn't very accessible and presumabley is a private member which is open to changing between minor versions.

In cases where you may not be too sure in which order your modules will run in it would be easier to just call Iris.Init() in every one and have the module ignore all extra calls. (Atleast thats my opinion)

JakeyWasTaken avatar Apr 28 '25 23:04 JakeyWasTaken

I've allows this, but added it as a third argument. As a general principle, I don't think it's a good idea to allow multiple init calls to the same object, even if only one of them goes through. However, in the context of Roblox, and the order of scripts generally being independent, it is now allowed.

You'll need to use Iris.Init(nil, nil, true) in order to satisfy the third option.

SirMallard avatar Jun 27 '25 11:06 SirMallard