-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
Support for multiple return variables #23055
Comments
I think, GDScript was inspired by Python where this feature as in several other languages, called "tuple" |
It also has dictionaries, which are inspired by Lua's, but I guess multiple return variables is a very common thing. |
They are? They seem extremely similar to Python's dictionaries. Lua instead has Tables, which though conceptually similar to Dictionaries have some pretty fundamental differences that GDScript doesn't seem to have? |
I'm neutral on this, but just adding that I've found dictionaries to be more convenient than arrays for returning multiple values. Mostly since it doesn't have a strict ordering of indices to remember, or need for extra work to create constants or enums to make readable labels for the indices.
|
Oh, It seems like I have overlooked something there. GDscript also supports the lua syntax of dictionaries: var table = {
key = "value"
} instead of pythons var table = {
"key" : "value"
} |
Yep, it supports different syntaxes, but it still 'works' like Python Dictionaries and not Lua Tables. |
I would opt for python/c# style tuples
Also possible support for something like |
This comment has been minimized.
This comment has been minimized.
@atbigelow Please don't bump issues without contributing significant new information. Use the 👍 reaction button on the first post instead. |
Feature and improvement proposals for the Godot Engine are now being discussed and reviewed in a dedicated Godot Improvement Proposals (GIP) (godotengine/godot-proposals) issue tracker. The GIP tracker has a detailed issue template designed so that proposals include all the relevant information to start a productive discussion and help the community assess the validity of the proposal for the engine. The main (godotengine/godot) tracker is now solely dedicated to bug reports and Pull Requests, enabling contributors to have a better focus on bug fixing work. Therefore, we are now closing all older feature proposals on the main issue tracker. If you are interested in this feature proposal, please open a new proposal on the GIP tracker following the given issue template (after checking that it doesn't exist already). Be sure to reference this closed issue if it includes any relevant discussion (which you are also encouraged to summarize in the new proposal). Thanks in advance! |
It's really not that complicated, here is how it works in Lua (which GDscript is inspired by):
Currently you would just create an array and put your variables in there, but there are three issues with that:
The text was updated successfully, but these errors were encountered: