Quote: "MyPartCards as PartCards[0]"
Creates An array with the real length of 1.
Use MyPartCards as PartCards[] or MyPartCards as PartCards[-1] to create an empty array.
MyPartCards.length=MyPartCards.length+1
MyPartCards[0].LifeCycle=16
I recommend you the following, if you get multiple entries:
MyPartCards.length=MyPartCards.length+1
pos = MyPartCards.length
MyPartCards[ pos ].LifeCycle=16
The TestTypeToArray function does not work.
I attach you a code, that may help:
Once you call FnTestArraysLoop, you copy your MyPartCards array into the PartCardList array, that is only inside this function. You can't call another function to refer on this array again.
type PartCards
LifeCycle as integer
endtype
MyPartCards as PartCards[]
MyPartCards.length=MyPartCards.length+1
MyPartCards[0].LifeCycle=16
FnTestArraysLoop(MyPartCards)
function FnTestArraysLoop(PartCardList as PartCards[])
do
TestTypeToArray( 0 )
print(MyPartCards[0].LifeCycle)
sync()
loop
endfunction
function TestTypeToArray( num)
MyPartCards[num].LifeCycle=random(0,100)
endfunction