Skip to content

Conversation

Efnilite
Copy link
Member

@Efnilite Efnilite commented Aug 6, 2025

Problem

Due to Skript's nature of having one statement per line, calling functions with many arguments may lead to unreadable long lines when specifying function arguments.

Solution

Adds a new SectionExpression for calling a function while specifying one argument per line. Every line sets a specific argument and is separated by set to to indicate that parameter x has value y.

set {_transformation} to function transformation with arguments:
    x set to vector(0, 0, 0)
    y set to vector(1, 1.5, 1)
    angle set to axisAngle(45, vector(2, 2, 2)
    axis set to {_axis}

Testing Completed

Added ExprSecFunction.sk tests.

Supporting Information

This PR uses code from the function package rework PR (#8112), and thus can only be merged once that has been merged.


Completes: #7924
Related: none

@Efnilite Efnilite added enhancement Feature request, an issue about something that could be improved, or a PR improving something. functions Related to functions labels Aug 6, 2025
@Efnilite Efnilite linked an issue Aug 6, 2025 that may be closed by this pull request
1 task
private static final Pattern ARGUMENT_PATTERN = Pattern.compile("(?<name>%s) set to (?<value>.+)".formatted(FUNCTION_NAME_PATTERN.toString()));

static {
Skript.registerExpression(ExprSecFunction.class, Object.class, ExpressionType.SIMPLE, "function <.+> with argument[s]");
Copy link
Member

Choose a reason for hiding this comment

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

this should probably just be a rework of ExprResult

@Efnilite Efnilite changed the title Mulitiline function calling Multiline function calling Aug 7, 2025
@Efnilite Efnilite requested a review from Burbulinis August 11, 2025 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request, an issue about something that could be improved, or a PR improving something. functions Related to functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow for multi-line function inputs
3 participants