Skip to content

Fix function list params with single default values and improve safety of loading functions #8135

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

Open
wants to merge 3 commits into
base: dev/patch
Choose a base branch
from

Conversation

Efnilite
Copy link
Member

Problem

Problem 1

local function test(arg1: texts="hey"):
    broadcast {_arg1::*}

on load:
    test()

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

@Efnilite Efnilite requested a review from a team as a code owner August 18, 2025 18:55
@Efnilite Efnilite added the bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. label Aug 18, 2025
@Efnilite Efnilite requested review from Pesekjak and TheMug06 and removed request for a team August 18, 2025 18:55
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label Aug 18, 2025
@sovdeeth sovdeeth moved this to In Review in 2.12 Releases Aug 18, 2025
@github-project-automation github-project-automation bot moved this from In Review to Awaiting Merge in 2.12 Releases Aug 18, 2025
@skriptlang-automation skriptlang-automation bot added patch-ready A PR/issue that has been approved and is ready to be merged/closed for the next patch version. and removed needs reviews A PR that needs additional reviews labels Aug 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. patch-ready A PR/issue that has been approved and is ready to be merged/closed for the next patch version.
Projects
Status: Awaiting Merge
Development

Successfully merging this pull request may close these issues.

5 participants