Skip to content

Conversation

@APickledWalrus
Copy link
Member

Problem

Currently, the enhanced function argument parsing with named arguments is too restrictive when optional parameters exist. For example, the following function call errors for a somewhat unclear reason: set {_loc} to location(x: 1, y: 1, z: 1, yaw: 1, pitch: 1) (Mixing named and unnamed arguments is not allowed unless the order of the arguments matches the order of the parameters.). This error is because the world parameter must occur before the yaw parameter. However, given that it is optional. one would expect for this function call to work without issue.

Solution

I have reworked the function argument parsing so that the user provided arguments are instead reworked into the order defined by the function signature. First, all named parameters are inserted into their respective positions. Then, the remaining unnamed arguments are inserted into the remaining positions. An unnamed parameter is only valid in its position if the named parameter it represents occurs before all named parameters that come after in the user's provided arguments.

For example, the following calls are now valid:
location(1, 2, 3, pitch: 10, yaw: 5) where 1, 2, and 3 represent x, y, and z respectively
location(x: 1, y: 2, z: 3, yaw: 4, 5) where 5 represents pitch
location(x: 1, 2, z: 3) where 2representsy`.

Further, I fixed a mistake where failures to parse arguments as expressions would result in the default value being used. Instead, an error about the input being invalid for that parameter is now parsed.

Testing Completed

I have added a few additional tests to StructFunction.sk

Supporting Information

n/a


Completes: none
Related: none
AI assistance: none

@APickledWalrus APickledWalrus requested a review from a team as a code owner January 5, 2026 20:43
@APickledWalrus APickledWalrus requested review from Pesekjak and removed request for a team January 5, 2026 20:43
@APickledWalrus APickledWalrus added bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. enhancement Feature request, an issue about something that could be improved, or a PR improving something. 2.14 Targeting a 2.14.X version release. labels Jan 5, 2026
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label Jan 5, 2026
@github-project-automation github-project-automation bot moved this to In Review in 2.14 Releases Jan 5, 2026
Copy link
Member

@Efnilite Efnilite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some extra comments would be appreciated 🙏

@skriptlang-automation skriptlang-automation bot removed the needs reviews A PR that needs additional reviews label Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.14 Targeting a 2.14.X version release. bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. enhancement Feature request, an issue about something that could be improved, or a PR improving something.

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

4 participants