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

Change make_function API to work well with different script languages #12908

Open
neikeq opened this issue Nov 13, 2017 · 8 comments
Open

Change make_function API to work well with different script languages #12908

neikeq opened this issue Nov 13, 2017 · 8 comments

Comments

@neikeq
Copy link
Contributor

neikeq commented Nov 13, 2017

Issue description:
Currently, the API to add a function to scripts, which is used by the connections dialog, is ScriptLanguage::make_function(class, name, args).
This method is expected to return a string with the function's declaration and body. The returned string is appended to the end of the script's source. This may be fine for languages like GDScript, but it won't work for other languages.

This API should be changed to receive Ref<Script> and either be expected to modify it or to return its full source code with the newly added function.

@neikeq neikeq changed the title Change make_function`` Change make_function API to work well with different script languages Nov 13, 2017
@neikeq neikeq added this to the 3.0 milestone Nov 13, 2017
@akien-mga
Copy link
Member

The clock is ticking if you want to implement this for 3.0.

@reduz
Copy link
Member

reduz commented Jan 8, 2018

agreed, shuold be done, though i think it should also somehow work with visual script

@neikeq
Copy link
Contributor Author

neikeq commented Sep 17, 2019

Please don't close this in the transition to godotengine/godot-proposals as I plan to implement it myself for 4.0. At least for text based scripts; I haven't thought about visual script yet.

@akien-mga
Copy link
Member

Just commenting to clarify that this is still relevant despite the issue's age.

@YuriSizov YuriSizov modified the milestones: 4.0, 4.x Feb 22, 2023
@YuriSizov
Copy link
Contributor

This is still relevant, and there is even a note in code about this limitation. But changing it in 4.x as described would be a breaking change, so we would need to think of a better solution, perhaps.

@neikeq
Copy link
Contributor Author

neikeq commented Feb 25, 2023

I'm no longer convinced about the solution I propose in my original message, because this feature still has problems with external editors, which is what most C# devs use.

Perhaps the code could be copied to the clipboard instead (displaying a toast notification).

@JensvandeWiel

This comment was marked as off-topic.

@Calinou
Copy link
Member

Calinou commented Nov 20, 2023

@JensvandeWiel Please don't bump issues without contributing significant new information. Use the 👍 reaction button on the first post instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

6 participants