Skip to content
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

Dynamic function calling. #6713

Open
wants to merge 41 commits into
base: feature/script-reflection
Choose a base branch
from

Conversation

Moderocky
Copy link
Member

@Moderocky Moderocky commented May 19, 2024

Additions

New types
executable
function
Obtain function references by name (& source)
[the|a] function [named] %string% [local:(in|from) %script%]
[the] functions [named] %strings% [local:(in|from) %script%]
[all] [the] functions (in|from) %script%
Run function references & get results
# effect
(run|execute) %executable% [with [arg[ument]s]] %-objects%]
# expression for return value
[the] result of %executable% [with [arg[ument]s]] %-objects%]
Little examples
set {_function} to the function named "myFunc"
run {_function} with arguments "hello", "there"
set {_thing} to the result of {_function} with arguments "hello", "there"

Infrastructure

Road-map of future plans

I'm setting down a bit of API here for future Skript features/addons to use,
especially ones that want to run tasks.

I have a few ideas about what I would like to do with this, but nothing finalised yet.

image

Target Minecraft Versions: any
Requirements: none
Related Issues: fixes #1265, fixes #5838, requires #6702

@Moderocky Moderocky added the enhancement Feature request, an issue about something that could be improved, or a PR improving something. label May 19, 2024
@Fusezion
Copy link
Contributor

What about #6254?

@Pikachu920
Copy link
Member

also see #6254 (comment). i have to be honest - i'm not really a fan of reflective capabilities in vanilla skript

@sovdeeth
Copy link
Member

I, too, am not a big fan.
Will update this message with links to my previously expressed opinions on this tomorrow.

@Asleeepp
Copy link
Contributor

Sorry if im blanking right now, but why would you even need this in the first place? you could just... run the function? i dont see any point for this atleast in my eyes

Copy link
Member

@sovdeeth sovdeeth left a comment

Choose a reason for hiding this comment

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

just some clerical stuff, nice work!

src/main/java/ch/njol/skript/effects/EffRun.java Outdated Show resolved Hide resolved
src/main/java/ch/njol/skript/effects/EffRun.java Outdated Show resolved Hide resolved
src/main/java/ch/njol/skript/expressions/ExprFunction.java Outdated Show resolved Hide resolved
src/main/java/ch/njol/skript/expressions/ExprFunction.java Outdated Show resolved Hide resolved
src/main/java/ch/njol/skript/expressions/ExprResult.java Outdated Show resolved Hide resolved
src/main/java/ch/njol/skript/expressions/ExprResult.java Outdated Show resolved Hide resolved
src/main/java/org/skriptlang/skript/util/Executable.java Outdated Show resolved Hide resolved
@Pikachu920 Pikachu920 mentioned this pull request Sep 7, 2024
1 task
Copy link
Member

@sovdeeth sovdeeth left a comment

Choose a reason for hiding this comment

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

tests failing and unresolved changes

Copy link
Member

@APickledWalrus APickledWalrus left a comment

Choose a reason for hiding this comment

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

Are you able to update this since the main PR was merged? Feel free to re-request after

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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.