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

Add concatenation support and a new constructor to Godot.Collections.Array #42000

Merged
merged 1 commit into from
Sep 13, 2020

Conversation

aaronfranke
Copy link
Member

@aaronfranke aaronfranke commented Sep 12, 2020

The primary reason for adding this is having a more consistent feature set with GDScript arrays. Test code:

var array1 = new Godot.Collections.Array("One", 2);
var array2 = new Godot.Collections.Array(3, "Four");
GD.Print(array1 + array2); // Prints [One, 2, 3, Four]

Compared to this GDScript code (there is a difference with the strings including quotation marks or not):

var array1 = ["One", 2]
var array2 = [3, "Four"]
print(array1 + array2) # Prints ["One", 2, 3, "Four"]

Test code for typed array:

var array3 = new Godot.Collections.Array<Vector2>(new Vector2(1, 2), new Vector2(3, 4));
var array4 = new Godot.Collections.Array<Vector2>(new Vector2(5, 6), new Vector2(7, 8));
GD.Print(array3 + array4); // Prints [(1, 2), (3, 4), (5, 6), (7, 8)]

@aaronfranke aaronfranke added enhancement topic:dotnet cherrypick:3.x Considered for cherry-picking into a future 3.x release labels Sep 12, 2020
@aaronfranke aaronfranke added this to the 4.0 milestone Sep 12, 2020
@aaronfranke aaronfranke changed the title Add concatenation support to Godot.Collections.Array Add concatenation support and a new ctor to Godot.Collections.Array Sep 12, 2020
@aaronfranke aaronfranke changed the title Add concatenation support and a new ctor to Godot.Collections.Array Add concatenation support and a new constructor to Godot.Collections.Array Sep 12, 2020
@akien-mga akien-mga merged commit 4331bea into godotengine:master Sep 13, 2020
@akien-mga
Copy link
Member

Thanks!

@aaronfranke aaronfranke deleted the cs-arr-concat branch September 13, 2020 06:46
@akien-mga
Copy link
Member

Cherry-picked for 3.2.4.

@akien-mga akien-mga removed the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Sep 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants