Fix function list params with single default values and improve safety of loading functions #8135
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.
Problem
Problem 1
The following code would not set
{_arg1::*}
to any value. Therefore, this code would return null.Problem 2
Errors occurring during loading of functions would cause the function signature to be taken. This would disallow reloading the script to try and fix the problem, as the signature would still be in memory. This is mainly to improve reliability with addons who do not correctly handle invalid values.
Solution
Problem 1
If a parameter is keyed and there is only one default value, the code will now convert this single value to a KeyedValue, allowing the variable to be set correctly.
Problem 2
Adds a try/catch to loading ScriptFunctions. On a SkriptAPIException, the signature will be de-registered. This will allow users to attempt re-registration.
Testing Completed
Problem 1
Added test to StructFunction.
Problem 2
Manual testing.
Supporting Information
Completes: none
Related: none