Notifications
Clear all
[Closed] Unknown property???
Mar 17, 2012 1:17 pm
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?
4 Replies
Mar 17, 2012 1:17 pm
(append axles Axle)
should be
(append axles Axle[b]()[/b])
you were collecting references to the struct definition rather than actual instances
Mar 17, 2012 1:17 pm
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?