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

Disabling built-in functions #1538

Closed
petrihakkinen opened this issue Nov 19, 2024 · 6 comments · Fixed by #1563
Closed

Disabling built-in functions #1538

petrihakkinen opened this issue Nov 19, 2024 · 6 comments · Fixed by #1563
Assignees
Labels
enhancement New feature or request

Comments

@petrihakkinen
Copy link
Contributor

Luau currently does not have a way to modify built-in libraries like vanilla Lua does. Even though it is possible to remove, rename or overwrite global functions and functions in module tables using the C API (before loading any scripts), the built-ins hardcoded in the compiler always exists and have priority.

This means that any new built-in introduced to Luau can effectively force embedders to rename their existing functions with the same name.

This issue came up when adopting the vector library but it is a more generic issue only somewhat related to the vector library.

One way to resolve this would be to a new field disabledBuiltIns to Luau::CompileOptions.

@petrihakkinen petrihakkinen added the enhancement New feature or request label Nov 19, 2024
@petrihakkinen petrihakkinen changed the title Disabling built-ins functions Disabling built-in functions Nov 19, 2024
@vegorov-rbx vegorov-rbx self-assigned this Dec 2, 2024
@vegorov-rbx
Copy link
Collaborator

Similar to other options, it seems like it can be a list of libraries and not specific functions.
Or will it be better for you to select functions individually?

@petrihakkinen
Copy link
Contributor Author

I think it would be better to allow functions to be selected individually, if possible. That would allow removing colliding functions (or monkey patching) without losing fastcalls for every other function in the same module. This would be future-proof with any new functions added to the language.

Would it be possible to specify the functions as "<optional-module>.<function>". Imaginary example: "setmetatable", "vector.dot", "table.clear"?

@vegorov-rbx
Copy link
Collaborator

Yes, it should be possible that way and does make sense.

@Nickhulb
Copy link

Nickhulb commented Dec 3, 2024

thx for the update

@vegorov-rbx
Copy link
Collaborator

Should be implemented in the sync this week.

@petrihakkinen
Copy link
Contributor Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging a pull request may close this issue.

3 participants