Skip to content

Fix function parameters with default value as list causing error#8221

Merged
sovdeeth merged 5 commits intodev/patchfrom
patch/fix-function-list-default-values
Oct 24, 2025
Merged

Fix function parameters with default value as list causing error#8221
sovdeeth merged 5 commits intodev/patchfrom
patch/fix-function-list-default-values

Conversation

@Efnilite
Copy link
Copy Markdown
Member

@Efnilite Efnilite commented Oct 2, 2025

Problem

Function parameters with a default value as a list cause errors.

function test(xs: integers = (1, 7)) :: integers:
    return {_xs::*}

This would error as (1, 7) is not a KeyedValue, while ScriptFunction expects that every argument that is a list or array is a KeyedValue.

Solution

Adds a backup for setting the variable in case the passed argument has multiple elements (any array or list), but is not a KeyedValue. All values with multiple elements should still be passed as a KeyedValue by any API.

Testing Completed

Added test file.

Supporting Information


Completes: #8220
Related: none

@Efnilite Efnilite requested a review from a team as a code owner October 2, 2025 09:44
@Efnilite Efnilite added the bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. label Oct 2, 2025
@Efnilite Efnilite requested review from Pesekjak and TheMug06 and removed request for a team October 2, 2025 09:44
@Efnilite Efnilite requested a review from erenkarakal October 2, 2025 10:01
@sovdeeth sovdeeth linked an issue Oct 2, 2025 that may be closed by this pull request
1 task
@Efnilite Efnilite requested a review from sovdeeth October 11, 2025 15:48
@APickledWalrus APickledWalrus moved this to Awaiting Merge in 2.13 Releases Oct 15, 2025
@Efnilite Efnilite closed this Oct 18, 2025
@Efnilite Efnilite reopened this Oct 22, 2025
@skriptlang-automation skriptlang-automation bot added the patch-ready A PR/issue that has been approved and is ready to be merged/closed for the next patch version. label Oct 22, 2025
@sovdeeth sovdeeth merged commit 1dcbd3d into dev/patch Oct 24, 2025
5 checks passed
@github-project-automation github-project-automation bot moved this from Awaiting Merge to Done - Awaiting Release in 2.13 Releases Oct 24, 2025
@skriptlang-automation skriptlang-automation bot added completed The issue has been fully resolved and the change will be in the next Skript update. and removed patch-ready A PR/issue that has been approved and is ready to be merged/closed for the next patch version. labels Oct 24, 2025
@Efnilite Efnilite deleted the patch/fix-function-list-default-values branch October 26, 2025 13:53
@APickledWalrus APickledWalrus moved this from Done - Awaiting Release to Done - Released in 2.13 Releases Nov 2, 2025
erenkarakal pushed a commit to erenkarakal/Skript that referenced this pull request Nov 26, 2025
…iptLang#8221)

* Init commit

* use Variable.SEPARATOR

* requested changes
erenkarakal pushed a commit to erenkarakal/Skript that referenced this pull request Nov 26, 2025
…iptLang#8221)

* Init commit

* use Variable.SEPARATOR

* requested changes
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. completed The issue has been fully resolved and the change will be in the next Skript update.

Projects

No open projects
Status: Done - Released

Development

Successfully merging this pull request may close these issues.

Returning list of default values of function throws severe error

4 participants