Unknown property???


#1

Encountered quite strange issue… I’ve got my own structure defined and I try to assign some value to one of it’s properties using dropdown lis. It shows me:


 struct Axle (
 	lenght = 0.0,		-- axle lenght in [m]
 	yPos = 0.0,			-- = carLenght/2-distanceFromFront
 	wRadius = 0.0,		-- wheels' radius in [m]
 	wWidth = 0.0,		-- wheels' width in [m]
 	wMass = 0.0,		-- wheels' mass in [kg]
 	susp = 1,			-- suspension type
 	drive = false		-- if the axle is a driving one
 )
 [...]
 global axles = #()		-- array to keep axles' properties
  for i=1 to nrVal do (append axles Axle)
  rollout AxleRollout "Axles' Properties" width:140 height:366 (
  [...]
  on axle_list selected sel do (			-- set the chosen axle's suspension type
  		axles[axle_spin.value].susp = sel
  	)
  [...]
 )
 

What have I done wrong?


#2
(append axles Axle)

should be

(append axles Axle[b]()[/b])

you were collecting references to the struct definition rather than actual instances


#3

Kinda better…
Now it says it has argument count error:
“append wanted 2, got 3”
… though I only changed “Axle” to “Axle()”


   for i=1 to nrVal do ( append axles Axle() )
   

EDIT:
Ok, nvmd, I changed to

axles[i] = Axle()

and it works. The above issue is quite interesting though. Any ideas why did it throw such error?


#4

   for i=1 to nrVal do ( append axles (Axle()) )
   

#5

my bad, lo made the correction for me


#6

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.