-
-
Notifications
You must be signed in to change notification settings - Fork 21.8k
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
Any chance to have Array.join(Array)? #11073
Comments
What would it do? Is it like this?: https://www.w3schools.com/jsref/jsref_join.asp |
By the name of the issue, it sounds more like OP wants a function more like concat. A join method I feel would be useful on string, like how python operates. |
You know you can do: |
For me, I'd assume the + operator would do addition on each element and return |
@Noshyaar Sounds like something that APL or Matlab would do |
@vnen lol its works, everyday learning something new :3 |
@raymoo that join is useless in gdscript because we can't override to_string() (so sad about this) |
@lorenzobeccaro Union is similar semantically to "or": a value is in |
@raymoo got it. |
Well, by this logic I would expect a compiler error as it would be doing vector math with a Vector3 + a Vector2, which is undefined. But as in Python, you concatenate lists (in GDScript, arrays) using |
@akien-mga I use that example just to say that |
Well I guess there would be no hurt in adding support for Array.join() too if it's wanted. |
Could it be called |
Having a separate concat might make sense actually. Let's say you have array1 and array2. You want to do something like |
I agree with KoBeWi. Being able to mutate the original array without creating a new one is an important use-case that should be supported. |
No description provided.
The text was updated successfully, but these errors were encountered: