Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow more advanced instance guards in component config #32

Closed
Zyrakia opened this issue Dec 16, 2021 · 1 comment
Closed

Allow more advanced instance guards in component config #32

Zyrakia opened this issue Dec 16, 2021 · 1 comment
Labels
domain: components Related to the Components flamework module invalid This doesn't seem right

Comments

@Zyrakia
Copy link

Zyrakia commented Dec 16, 2021

I was thinking maybe the instanceGuard property of the component config could return a boolean instead of a t.check so you could do things like return instance.Parent?.IsA("Backpack"), this would lead to the component not being created if the parent of the instance is not a backpack.

For backwards compatibility, you could have have it return a t.check or a boolean, it wouldn't be too much trouble to handle both scenarios in the implementation.

This seems like it would be pretty easy to do, I could try implementing it if this sounds appealing at all and is approved.

@Fireboltofdeath Fireboltofdeath added invalid This doesn't seem right domain: components Related to the Components flamework module labels Dec 16, 2021
@Fireboltofdeath
Copy link
Member

t.check is just (obj: unknown) => obj is T which is a boolean. You can just specify a function in instanceGuard that does whatever checks you want it to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: components Related to the Components flamework module invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants