>> component documentation
> You said components above
I was just referring to the cfcexplorer.
>check the size of the arguments array
nice.. didn't think of that.
> -----Original Message-----
>
>
> > wow!.. I didn't know you could do that. Is there *any* way
> > to make them private? I noticed that the component
> > documentation says all the arguments are required, is it
> > possible to declare which arguments are required and which
> > ones aren't? What else can you do with this... playing with
> > it, it really doesn't seem very flexible, but I still have hope.
>
> You said components above - although we are talking about script based
> udfs. For a CFFUNCTION type UDF or METHOD, any <CFARGUMENT> tag w/o a
> required setting will default to NOT being required. In a script based
> udf, any argument declared is required. For example:
>
> function add(x,y) {
> return x+y;
> }
>
> In this UDF, both x and y are required because they are declared. To use
> optional arguments, you simply check the size of the arguments array.
>
> function addMore(x,y) {
> var c = 0;
> if(arrayLen(arguments) gte 3) c = arguments[3];
> return x+y+c;
> }
>
> Or even
>
> function addALotOfCrap() {
> var total = 0;
> var i = 1;
>
> for(;i lte arrayLen(arguments);i=i+1) {
> total = total + arguments[i];
> }
>
> return total;
> }
>
> Or even better, if you trust all arguments are numeric: return
> arraySum(arguments);
>
> Anyway, you get the idea. For more examples of UDFs, check out
> www.cflib.org
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Get the mailserver that powers this list at
http://www.coolfusion.com