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.
The clock is ticking if you want to implement this for 3.0.
agreed, shuold be done, though i think it should also somehow work with visual script
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.
Most helpful comment
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.