Add compileError when a function is used where it is not supported #152
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a
@compileError
statement with a helpful error message if the user tries to reference a function that is unavailable in their chosen lang.Most of these functions previously only had a doc comment clarifying e.g. that they're only supported in Luau, so in most cases this adds additional safety. However, there was one function,
raiseInterruptErrorStr
, which became a no-op if the lang weren't Lua, instead of providing an error. While I took the approach of raising a compile error if the function were used but not supported, there is precedent of turning an unsupported function into a no-op. While I believe the more appropriate path would be to raise a compile error, I'm interested in hearing what the preferred outcome is for these cases.