Putting an array in a struct.
-
I’m trying to tidy up some code. So instead of having Separate variables ’map1’, ’colourmap1’, ’map1name’, ’map1size’ etc, I want to put them all in a struct. I’m trying this:
struct map String name Array grid Array colourmap Int size Terrain terrain Endstruct
When I do this, I get ’syntax error, unexpected array, expecting left bracket’ on line 3.
I’ve tried putting some brackets in and doing various stuff, but I keep on getting syntax errors. How am I supposed to go about this please? Or am I just way off-base..?
-
@toxibunny It seems to be expecting a size on the array declaration. I am not sure why as arrays are generally dynamic.
struct string name array grid[8][8] endstruct
-
Okay, thanks!
-
@pianofire so will that be a change soon?
-
@toxibunny what happens if you declare your stract the short way.
-
I dunno, I’ve never done it!
-
@toxibunny Try it
-
Ive tried that before and it seems you can't assign arrays to structs if you do it with clamps. Only with Arrays you've Initialised before.
-
Sorry to butt in, but with reference to arrays what's a clamp?
-
@faz808 I think clamp is a fixed value so you can use it to make a rotation stop at certain angles as one example
-
Yes clamp keeps a value between a maximum and a minimum https://fuzearena.com/help/view/clamp Not sure how this applies to assigning arrays to structs though
-
You worry about your programming knowledge when you come across a term you've not seen before. I'm from the old school - bits, bytes nibbles, words etc . Love em !