Structure Part
part_name.s
sound.b
hours.b
minuts.b
seconds.b
EndStructure
Structure Session
session_name.s
Array part_Array.Part(10)
EndStructure
Global Dim part_Array.Part(10)
Global session.Session
Procedure FillPartArray(part_default.Part, snd_nbr.b, n); Here is the syntax error
Define i = n
For x = 0 To (i - 1)
With part_default
\part_name = "New Part " + Str(i)
\sound = snd_nbr
\hours = 0
\minuts = 5
\seconds =0
part_Array(x) = part_default
EndWith
Next x
EndProcedure
Structure Part
part_name.s
sound.b
hours.b
minuts.b
seconds.b
EndStructure
Structure Session
session_name.s
Array part_Array.Part(10)
EndStructure
Global Dim part_Array.Part(10)
Global session.Session
Procedure FillPartArray(List part_default.Part(), snd_nbr.b, n); Here is the syntax error
Define i = n
For x = 0 To (i - 1)
With part_default()
\part_name = "New Part " + Str(i)
\sound = snd_nbr
\hours = 0
\minuts = 5
\seconds =0
part_Array(x) = part_default()
EndWith
Next x
EndProcedure
BarJo wrote: Fri Jan 19, 2024 4:39 am
Hi jphoarau,
I am still a beginner with SpiderBasic, but I would have coded it like this:
Thanks for your answer. It makes me understand my mistake. A Structure can't be passed as Procedure parameter. It must be passed by pointer. I have found this with your help:
Structure Part
part_name.s
sound.b
hours.b
minuts.b
seconds.b
EndStructure
Structure Session
session_name.s
Array part_Array.Part(10)
EndStructure
Global Dim part_Array.Part(10)
Global session.Session
Global part_default.Part
Procedure FillPartArray(*part_temp.Part, snd_nbr.b, n); Here is the syntax error
Define i = n
For x = 0 To (i - 1)
With *part_temp
\part_name = "New Part " + Str(i)
\sound = snd_nbr
\hours = 0
\minuts = 5
\seconds =0
EndWith
part_Array(x) = part_default
Next x
EndProcedure
FillPartArray(@part_default, 0, 3)
BarJo wrote: Fri Jan 19, 2024 4:39 am
Hi jphoarau,
I am still a beginner with SpiderBasic, but I would have coded it like this:
Thanks for your answer. It makes me understand my mistake. A Structure can't be passed as Procedure parameter. It must be passed by pointer. I have found this with your help:
Structure Part
part_name.s
sound.b
hours.b
minuts.b
seconds.b
EndStructure
Structure Session
session_name.s
Array part_Array.Part(10)
EndStructure
Global Dim part_Array.Part(10)
Global session.Session
Global part_default.Part
Procedure FillPartArray(*part_temp.Part, snd_nbr.b, n); Here is the syntax error
Define i = n
For x = 0 To (i - 1)
With *part_temp
\part_name = "New Part " + Str(i)
\sound = snd_nbr
\hours = 0
\minuts = 5
\seconds =0
EndWith
part_Array(x) = part_default
Next x
EndProcedure
FillPartArray(@part_default, 0, 3)