Dynamic Array Struct...
-
Is it possible to create dynamic arrays for struct ?
If I get the exemple about struct with no dimension I obtain a error...struct shape string name int sides int size vector pos int col endStruct shape shapes[]
In the worst case, I could create an array with only one object and redim it (add or remove) with code but I can't find instruction to do it...
Does anyone find a way ?
-
Try the syntax:
shape shapes = []
Here are more discussions on the subject:
https://fuzearena.com/forum/topic/254/dynamic-array-sizes/7 -
Not the same error, but still not doing the job.
Thanks for your link -
not perfect, but it works :
struct shape string name int sides int size vector pos int col endStruct shapes=[] shapes[0] = [ .name = "triangle", .sides=3, .size=150, .pos = { 400, 150 }, .col = red ] shapes[1] = [ .name = "square", .sides=4, .size=150, .pos = { 400, 500 }, .col = yellow ]
-
@Electric-Dreams edited your text to make the code clearer.
Please see this post in the FAQ (last question): https://fuzearena.com/forum/topic/226/faq-common-questions-and-answers/4
-
Very nice !
Thank's you for the tips @Martin