How many parameters

Blitz3D Forums/Blitz3D Beginners Area/How many parameters

PowerPC603(Posted 2004) [#1]
Is there a certain limit within Blitz3D to how many parameters there can be passed to a function?

I thought the limit in VB6.0 was 6 parameters, but not sure in Blitz.

Like this:
Function DoSomething(ParamA%, ParamB%, ParamC%, ParamD$)
; This function now receives 4 parameters
End Function


And how do you set a default value to a certain parameter?
Is it this way:
Function DoSomething(ParamA%, ParamB% = 5)
End Function


If it is, must all further parameters (if there were some more after "ParamB%") also have a default value?


Rob Farley(Posted 2004) [#2]
As far as I'm aware there is no such restriction on the number of parameters (the probably is but I've never found it). For example I've got a function:
SpawnParticle(x#,y#,z#,delx#,dely#,delz#,start_rot,rot#,life,start_scale#,end_scale#,gravity#,graphic,fx$,name$="")

Regarding default values, it's usually best to put all your parameters with default values at the end of your parameter list.

If you've got function nothing(a=1,b,c)

Then you would need to pass it all 3 values, however, if you ordered your function as Function nothing(b,c,a=1) then you'd only need to pass the first 2.


Erroneouss(Posted 2004) [#3]
ive seen this.... :) ..(wasnt by me tho)
from a tree creating function in code archives...

 Function CreateTree(Wiggle_Flag=2,Branches_On_End_Flag=2,Leaf_Type=-1,Leaf_Mesh=100,Number_Of_Large_Branches=5,Number_Of_Medium_Branches=3,Number_Of_Small_Branches=7,Large_Branch_Minimum_Angle#=20,Medium_Branch_Minimum_Angle#=20,Small_Branch_Minimum_Angle#=20,Large_Branch_Maximum_Angle#=40,Medium_Branch_Maximum_Angle#=40,Small_Branch_Maximum_Angle#=40,Tree_Trunk_Size#=9,Large_Branch_Size_Min#=2,Medium_Branch_Size_Min#=2,Small_Branch_Size_Min#=2,Large_Branch_Size_Max#=4,Medium_Branch_Size_Max#=3,Small_Branch_Size_Max#=4,Trunk_seg=15,LBranch_seg=4,MBranch_seg=4,SBranch_seg=4,Trunk_Big_Dia#=1,Trunk_Small_Dia#=.8,LBranch_Big_Dia#=.6,LBranch_Small_Dia#=.4,MBranch_Big_Dia#=.3,MBranch_Small_Dia#=.2,SBranch_Big_Dia#=.1,SBranch_Small_Dia#=.05)




PowerPC603(Posted 2004) [#4]
Thanks buddies...


CS_TBL(Posted 2004) [#5]
I put one of my 'long' functions-names into that userlibdirthingy and BP didn't display all params for that function!

The function works however..